Skip to content

Commit

Permalink
Bug 1535765 [wpt PR 15779] - XMLSerializer: Keep redundant but harmle…
Browse files Browse the repository at this point in the history
…ss default namespace declarations, a=testonly

Automatic update from web-platform-tests
XMLSerializer: Keep redundant but harmless default namespace declarations

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 <yosinchromium.org>
Commit-Queue: Kent Tamura <tkentchromium.org>
Auto-Submit: Kent Tamura <tkentchromium.org>
Cr-Commit-Position: refs/heads/master{#639873}

--

wpt-commits: 4dc79803ad127fb635a03ec8b248c8671b4c3b67
wpt-pr: 15779

UltraBlame original commit: 41a76d86404be10336a61e3a8fbd86ac0aca467f
  • Loading branch information
marco-c committed Oct 4, 2019
1 parent c4331ff commit 3fbba0d
Showing 1 changed file with 159 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,165 @@
(
)
{
assert_equals
(
serialize
(
parse
(
'
<
root
>
<
child
xmlns
=
"
"
/
>
<
/
root
>
'
)
)
'
<
root
>
<
child
/
>
<
/
root
>
'
)
;
assert_equals
(
serialize
(
parse
(
'
<
root
xmlns
=
"
"
>
<
child
xmlns
=
"
"
/
>
<
/
root
>
'
)
)
'
<
root
>
<
child
/
>
<
/
root
>
'
)
;
assert_equals
(
serialize
(
parse
(
'
<
root
xmlns
=
"
u1
"
>
<
child
xmlns
=
"
u1
"
/
>
<
/
root
>
'
)
)
'
<
root
xmlns
=
"
u1
"
>
<
child
/
>
<
/
root
>
'
)
;
}
'
Check
if
redundant
xmlns
=
"
.
.
.
"
is
dropped
.
'
)
;
test
(
function
(
)
{
const
root
=
Expand Down Expand Up @@ -2099,97 +2258,6 @@
'
<
root
>
<
child
xmlns
=
"
"
/
>
<
/
root
>
'
)
)
'
<
root
>
<
child
/
>
<
/
root
>
'
)
;
assert_equals
(
serialize
(
parse
(
'
<
root
xmlns
=
"
u1
"
>
<
child
xmlns
=
"
u1
"
/
>
<
/
root
>
'
)
)
'
<
root
xmlns
=
"
u1
"
>
<
child
/
>
<
/
root
>
'
)
;
assert_equals
(
serialize
(
parse
(
'
<
root
xmlns
=
"
Expand Down

0 comments on commit 3fbba0d

Please sign in to comment.