Skip to content

anonymous /comment.pl
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
HTML4 comment parsing issue with Mojo::DOM
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use Mojo::DOM;
use HTML::TreeBuilder;
my $content = <<'EOF';
<html>
<body>
<!-- This is a valid comment -- >
<p>Here's a paragraph</p>
</body>
</html>
EOF
{
my $dom = Mojo::DOM->new( $content );
say "Mojo:\n" . $dom;
}
{
my $dom = HTML::TreeBuilder->new_from_content($content);
say "Tree:\n" . $dom->as_HTML('<>&', ' ');
}
__END__
Mojo:
<html>
<body>
<!-- -- a comment is this valid>
<p>Here&#39;s a paragraph</p>
</!--></body>
</html>
Tree:
<html>
<head>
</head>
<body>
<p>Here's a paragraph</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.