XMLSerializer: Don't add unnecessary prefix to an element in the default namespace #16703
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.
This CL fixes a regression by crrev.com/632459.
Suppose that we have the following XML document:
<root xmlns:x="uri1">
<table xmlns="uri1"/>
</root>
XMLSerializer generated the following result:
<root xmlns:x="uri1">
<x:table xmlns="uri1"/>
</root>
We don't need to run "retrieving a preferred prefix string" algorithm if
the element has no prefix and its namespace matches to the default
namespace.
This is an error of the specification, and Edge, Firefox, and Safari
match to this CL's behavior. This CL adds a testcase following the
specification error, and the testcase fails with all major browsers.
Bug: 958298
Change-Id: I3af9e643a9f91221e56024192f7257a82b6f18cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1598929
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#657586}