validator / htmlparser

The Validator.nu HTML parser https://about.validator.nu/htmlparser/
Other
56 stars 26 forks source link

Ensure namespace-aware “clear the stack” handling #42

Closed sideshowbarker closed 3 years ago

sideshowbarker commented 4 years ago

This change ensures that for all cases with spec requirements in the form “clear the stack back to a foo context” — which involves checking for elements with particular names — we only look for elements in the HTML namespace, rather than additionally looking for elements which aren’t in the HTML namespace but that also have those particular names.

Otherwise, without this change, we aren’t in conformance with the spec requirements, and we fail several cases in the html5lib-tests suite.

Fixes https://github.com/validator/htmlparser/issues/33


Without this change, we’re failing the following html5lib-tests fragment-parsing cases:

…and also failing the corresponding tests in https://github.com/html5lib/html5lib-tests/blob/master/tree-construction/svg.dat

hsivonen commented 3 years ago

I pushed this via the command line as 6c124b3678b9d38a9cd3816b2699c54644cf132b and now I don't know how to make the GitHub PR metadata say merged instead of closed.

Thanks and sorry about the bad metadata state.