Skip to content

Commit

Permalink
fixed bug where Mojo::DOM::HTML could not handle tags with lots of at…
Browse files Browse the repository at this point in the history
…tributes
  • Loading branch information
kraih committed May 31, 2014
1 parent 3f63548 commit a0dac22
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Changes
@@ -1,5 +1,7 @@

5.02 2014-05-31
- Fixed bug where Mojo::DOM::HTML could not handle tags with lots of
attributes.

5.01 2014-05-30
- Fixed continuation line handling in Mojo::Headers.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/DOM/HTML.pm
Expand Up @@ -42,7 +42,7 @@ my $TOKEN_RE = qr/
\s*
[^<>\s]+ # Tag
\s*
(?:$ATTR_RE)* # Attributes
(?:(?:$ATTR_RE){0,32766})* # Attributes
)>
|
(<) # Runaway "<"
Expand Down
5 changes: 5 additions & 0 deletions t/mojo/dom.t
Expand Up @@ -2358,4 +2358,9 @@ is $dom->tree->[3][1], ' bad idea -- HTML5 ', 'right comment';
is $dom->tree->[5][1], ' HTML4 ', 'right comment';
is $dom->tree->[7][1], ' bad idea -- HTML4 ', 'right comment';

# Huge number of attributes
my $huge = '<div ' . ('a=b ' x 32768) . '>Test</div>';
$dom = Mojo::DOM->new($huge);
is $dom->at('div[a=b]')->text, 'Test', 'right text';

done_testing();

0 comments on commit a0dac22

Please sign in to comment.