Skip to content

Conversation

not-my-profile
Copy link

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.)

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.)

[1]: https://html.spec.whatwg.org/multipage/parsing.html#create-an-element-for-the-token
[2]: https://html.spec.whatwg.org/multipage/parsing.html#adjust-foreign-attributes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant