Hacker News new | ask | show | jobs
by ufo 2236 days ago
Is there a way to get warnings for HTML that looks valid with matching start and end tags but doesn't actually parse the way it is written? I get the impression that we end up needing to memorize those content categories even if we plan to only generate html with all the start and end tags.

For example, <p>A<p>B</p>C</p> looks like two nested <p> but it is parsed as 3<p> next to each other: <p>A</p><p>B</p>C<p></p>.

1 comments

At the margins, yes, but in practice if you have seemingly balanced opening and closing tags but invalid nesting, the outer close tag generally makes the HTML invalid, for which there's plenty of tooling to check.