-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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: Keep redundant but harmless default namespace declarations #15779
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already reviewed downstream.
@@ -145,8 +152,6 @@ <h1>domparsing_XMLSerializer_serializeToString</h1> | |||
|
|||
test(function() { | |||
assert_equals(serialize(parse('<root><child/></root>')), '<root><child/></root>'); | |||
assert_equals(serialize(parse('<root><child xmlns=""/></root>')), '<root><child/></root>'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we lost this particular input @tkent-google. A root without xmlns declaration and a child with one. Could you restore that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
098f676
to
ec47d94
Compare
…ions Since crrev.com/632142, XMLSerializer has dropped redundant xmlns="..." declarations. It matches to IE, Edge, and DOM P&S standard. This CL reverts the behavior to unbreak existing applications. The restored behavior matches to Firefox and Safari. * MarkupAccumulator::AppendElement(): Even if ignore_namespace_definition_attribute_ is set, we drop a xmlns="..." only if its value is inconsistent with element's namespace. * MarkupAccumulator::AppendStartTagOpen(): if local_default_namespace is "" and ns is null, do not emit xmlns="". This avoids to serialize xmlns="" twice. Bug: w3c/DOM-Parsing#47 Bug: 940204 Change-Id: I2978ddc9a3f9511d227a9a1b902f1811ac1c3c07 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1516124 Reviewed-by: Yoshifumi Inoue <[email protected]> Commit-Queue: Kent Tamura <[email protected]> Auto-Submit: Kent Tamura <[email protected]> Cr-Commit-Position: refs/heads/master@{#639873}
ec47d94
to
dfc064d
Compare
Since crrev.com/632142, XMLSerializer has dropped redundant xmlns="..."
declarations. It matches to IE, Edge, and DOM P&S standard. This CL
reverts the behavior to unbreak existing applications. The restored
behavior matches to Firefox and Safari.
MarkupAccumulator::AppendElement():
Even if ignore_namespace_definition_attribute_ is set, we drop a
xmlns="..." only if its value is inconsistent with element's
namespace.
MarkupAccumulator::AppendStartTagOpen():
if local_default_namespace is "" and ns is null, do not emit xmlns="".
This avoids to serialize xmlns="" twice.
Bug: w3c/DOM-Parsing#47
Bug: 940204
Change-Id: I2978ddc9a3f9511d227a9a1b902f1811ac1c3c07
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1516124
Reviewed-by: Yoshifumi Inoue <[email protected]>
Commit-Queue: Kent Tamura <[email protected]>
Auto-Submit: Kent Tamura <[email protected]>
Cr-Commit-Position: refs/heads/master@{#639873}