From: Matt S Trout Date: Thu, 24 Feb 2011 20:10:16 +0000 (+0000) Subject: add / to excluded characters in attribute names to correctly parse
etc. X-Git-Tag: release_0.009005~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FHTML-Zoom.git;a=commitdiff_plain;h=abc91e12ee2174db8068e3c9423c9a4afc651aba add / to excluded characters in attribute names to correctly parse
etc. for
, the '/' was being interpreted as the attribute string so $in_place_close wasn't being set. Adding / to the exclusion list fixes this. --- diff --git a/Changes b/Changes index 88caf83..276af99 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ +- add / to excluded characters in attribute names to correctly parse
+ 0.009004 2011-02-14 - Large chunks of documentation improvements from jnareb diff --git a/lib/HTML/Zoom/Parser/BuiltIn.pm b/lib/HTML/Zoom/Parser/BuiltIn.pm index efa07cb..b55cc4d 100644 --- a/lib/HTML/Zoom/Parser/BuiltIn.pm +++ b/lib/HTML/Zoom/Parser/BuiltIn.pm @@ -23,7 +23,7 @@ sub _hacky_tag_parser { ( (?:[^<]*) < (?: ( / )? ( [^/!<>\s"'=]+ ) - ( (?:"[^"]*"|'[^']*'|[^"'<>])+? )? + ( (?:"[^"]*"|'[^']*'|[^/"'<>])+? )? | (!-- .*? -- | ![^\-] .*? ) ) (\s*/\s*)? > diff --git a/t/parser_weirdness.t b/t/parser_weirdness.t new file mode 100644 index 0000000..2abab01 --- /dev/null +++ b/t/parser_weirdness.t @@ -0,0 +1,26 @@ +use strictures 1; +use HTML::Zoom; +use Test::More; + +my $html = < +


+


+ +EOHTML + +HTML::Zoom->from_html($html) + ->select('body') + ->collect_content({ + into => \my @body + }) + ->run; + +is(HTML::Zoom->from_events(\@body)->to_html, <

+


+EOHTML + 'Parses cuddled in place close ok'); + +done_testing;