noscript tag allows nesting paragraphs in HTML
<noscript>
has transparent content model so adding paragraph inside is just like adding paragraph directly inside its parents. <p>
elements cannot contain block elements like other paragraphs and should be closed when start of block element is encountered.
libxml’s HTML parser handles this correctly when paragraphs are nested directly:
echo '<p>foo<p>bar</p></p>' | xmllint --html -
-:1: HTML parser error : Unexpected end tag : p
<p>foo<p>bar</p></p>
^
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body>
<p>foo</p>
<p>bar</p>
</body></html>
But that does not happen when <noscript>
is involved:
$ echo '<p>foo<noscript><p>bar</p></noscript></p>' | xmllint --html -
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body>
<p>foo<noscript><p>bar</p></noscript></p>
</body></html>
This issue hides another bug in html-tidy, which confused me quite a bit when debugging j0k3r/graby#240.
Edited by Jan Tojnar