domparsing: Fix an issue that XMLSerializer generates new prefix for an attribute with an existing namespace #15343
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.
Add an implementation of "retrieving a preferred prefix string"
[1], and apply it to attribute serialization.
As the specification defines, this CL introduces another map [2] like:
namespace URI => [older prefix, ..., newer prefix]
in order to retrieve most-recently-declared prefix.
When we search the map for a prefix, we check availability of
the prefix by the existing prefix-namespace map.
There are two failing test cases in XMLSerializer-serializeToString.html.
They follow the specification.
the specification. Chrome's new behavior matches to Firefox. Safari also
produces a bad XML.
preserve prefix in such case. This CL keeps the interoperable behavior.
[1] https://w3c.github.io/DOM-Parsing/#dfn-retrieving-a-preferred-prefix-string
[2] https://w3c.github.io/DOM-Parsing/#dfn-namespace-prefix-map
Bug: 906807
Change-Id: Idaea590ba19c9c21acbaf456ea91ce550c74db5a
Reviewed-on: https://chromium-review.googlesource.com/c/1445033
Commit-Queue: Kent Tamura <tkent@chromium.org>
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Auto-Submit: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#631573}