XMLSerializer: Fix prefixed attribute serialization #15340
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
... 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}