Skip to content

Commit

Permalink
fixed bug where Mojo::DOM::HTML could not handle certain broken tags
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 2, 2014
1 parent e8f341a commit dfd89c6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Changes
@@ -1,5 +1,6 @@

5.03 2014-06-01
5.03 2014-06-02
- Fixed bug where Mojo::DOM::HTML could not handle certain broken tags.

5.02 2014-05-31
- Added multi-name support to cookie and signed_cookie methods in
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){0,32766})* # Attributes
(?:(?:$ATTR_RE){0,32766}){0,32766}+ # Attributes
)>
|
(<) # Runaway "<"
Expand Down
5 changes: 5 additions & 0 deletions t/mojo/dom.t
Expand Up @@ -2363,4 +2363,9 @@ my $huge = '<div ' . ('a=b ' x 32768) . '>Test</div>';
$dom = Mojo::DOM->new($huge);
is $dom->at('div[a=b]')->text, 'Test', 'right text';

# Broken tag
$huge = '<br< abc abc abc abc abc abc abc abc<p>Test</p>';
$dom = Mojo::DOM->new($huge);
is $dom->at('p')->text, 'Test', 'right text';

done_testing();

0 comments on commit dfd89c6

Please sign in to comment.