Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

None yet

1 participant