commit f9e531e055de9ec311e36c38eb8d1ccca3972dc5
parent 9d7e24c52dfd0c00a155f9ac27df8718745b0f37
Author: Dominik Röttsches <drott@chromium.org>
Date: Wed, 3 Dec 2025 14:49:44 +0000
Bug 2003647 [wpt PR 56421] - Fix namespace reset in fragment parsing, a=testonly
Automatic update from web-platform-tests
Fix namespace reset in fragment parsing
When an explicit xmlns='' is encountered on an element in the
fragment. This child elements and elements below should no longer be
assigned the default namespace of the parent element to which this
fragment is appended.
Same fix applied to Rust parser implementation.
Add test to ensure namespace reset only applies to children.
Run innerhtml-and-xml-namespaces.svg in virtual test suite for
Rust parser.
Bug: 463630186
Change-Id: I545e914254fa5118cce4a681654c1ad087f3217c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7202654
Reviewed-by: David Baron <dbaron@chromium.org>
Commit-Queue: Dominik Röttsches <drott@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1552847}
--
wpt-commits: de0ed739c9591386a3d41bb11f684b03dfa9b083
wpt-pr: 56421
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/the-innerhtml-property/innerhtml-and-xml-namespaces.svg b/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/the-innerhtml-property/innerhtml-and-xml-namespaces.svg
@@ -80,6 +80,12 @@
}, "unsetting default namespace works inside parse of fragment (on child of element)");
test(() => {
+ prefixedContainer.innerHTML = "<e><f xmlns=''><g></g></f><h/></e>";
+ assert_equals(prefixedContainer.firstChild.firstChild.firstChild.namespaceURI, null);
+ assert_equals(prefixedContainer.firstChild.lastChild.namespaceURI, SVG_NS);
+ }, "default namespace applied to sibling of namespace-resetting element in parse of fragment.");
+
+ test(() => {
prefixedContainer.innerHTML = "<e><h:f xmlns:h='https://example.com/new-h'><g><h:d></h:d></g></h:f></e>";
assert_equals(prefixedContainer.firstChild.firstChild.namespaceURI, "https://example.com/new-h");
assert_equals(prefixedContainer.firstChild.firstChild.firstChild.namespaceURI, SVG_NS);