html5lib / html5lib-tests

Testsuite data for html5lib, including the de-facto standard HTML parsing tests.
MIT License
188 stars 58 forks source link

Add tests for xmlns & xmlns:xlink parse errors #174

Open not-my-profile opened 11 months ago

not-my-profile commented 11 months ago

This commit adds 14 tests for the two tree construction errors mentioned in the 12th step of "create an element for a token"1, which currently says:

If element has an xmlns attribute in the XMLNS namespace whose value is not exactly the same as the element's namespace, that is a parse error. Similarly, if element has an xmlns:xlink attribute in the XMLNS namespace whose value is not the XLink Namespace, that is a parse error.

Previously these errors weren't tested at all.

It's worth noting why <html xmlns="totally not html"> isn't a parse error according to the spec: "adjust foreign attributes"2 is only called on foreign elements (i.e. not on elements in the HTML namespace). (I would have liked to add a comment about this to the respective test cases but unfortunately the test case format doesn't support comments.)