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

XMLSerializer: Fix prefixed attribute serialization #15340

Merged
merged 1 commit into from Feb 12, 2019

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Feb 11, 2019

... in a case where its owner element has xmlns:prefix of which prefix
is same as the attribute and namespace is not same as the attribute.

e.g.
el.setAttributeNS("uri1", "p:n", "v");
el.setAttributeNS(XMLNS_URI, "xmlns:p", "uri2");

ShouldAddNamespaceAttribute() checked only existence of xmlns:prefix in
the element, but we should check existence of (prefix, namespace URI)
pair in the scope according to the specification.

So, this CL adds 'recording the namespace information' step [1] defined
by the specification, and ShouldAddNamespaceAttribute() checks all
available prefixes in the scope.

[1] https://w3c.github.io/DOM-Parsing/#recording-the-namespace

Bug: 929035
Change-Id: I575e8f652ae45f7583202443cc72d5afe5faf59d
Reviewed-on: https://chromium-review.googlesource.com/c/1460643
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#631058}

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already reviewed downstream.

... in a case where its owner element has xmlns:prefix of which prefix
is same as the attribute and namespace is not same as the attribute.

e.g.
  el.setAttributeNS("uri1", "p:n", "v");
  el.setAttributeNS(XMLNS_URI, "xmlns:p", "uri2");

ShouldAddNamespaceAttribute() checked only existence of xmlns:prefix in
the element, but we should check existence of (prefix, namespace URI)
pair in the scope according to the specification.

So, this CL adds 'recording the namespace information' step [1] defined
by the specification, and ShouldAddNamespaceAttribute() checks all
available prefixes in the scope.

[1] https://w3c.github.io/DOM-Parsing/#recording-the-namespace

Bug: 929035
Change-Id: I575e8f652ae45f7583202443cc72d5afe5faf59d
Reviewed-on: https://chromium-review.googlesource.com/c/1460643
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#631058}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants