From 3a356ffb74ec342500b92244437787a3cad3e0c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20W=C3=BClker?= Date: Sun, 23 Mar 2025 14:49:45 +0100 Subject: [PATCH] Don't clear children of declarative shadow hosts when imperatively attaching another shadow root (#36104) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Don't remove a declarative shadow hosts children when attaching an imperative shadow root Instead we should remove all children of the shadowroot. Signed-off-by: Simon Wülker * Update WPT expectations Signed-off-by: Simon Wülker --------- Signed-off-by: Simon Wülker --- components/script/dom/element.rs | 3 +- ...declarative-shadow-dom-attachment.html.ini | 102 ------------------ .../declarative-shadow-dom-repeats.html.ini | 3 - 3 files changed, 1 insertion(+), 107 deletions(-) delete mode 100644 tests/wpt/meta/shadow-dom/declarative/declarative-shadow-dom-attachment.html.ini diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 49bc12d3ae7..b62777710de 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -562,8 +562,7 @@ impl Element { } // Step 4.3.1. Remove all of currentShadowRoot’s children, in tree order. - let node = self.upcast::(); - for child in node.children() { + for child in current_shadow_root.upcast::().children() { child.remove_self(); } diff --git a/tests/wpt/meta/shadow-dom/declarative/declarative-shadow-dom-attachment.html.ini b/tests/wpt/meta/shadow-dom/declarative/declarative-shadow-dom-attachment.html.ini deleted file mode 100644 index 117b3f75b0e..00000000000 --- a/tests/wpt/meta/shadow-dom/declarative/declarative-shadow-dom-attachment.html.ini +++ /dev/null @@ -1,102 +0,0 @@ -[declarative-shadow-dom-attachment.html] - [Declarative Shadow DOM as a child of
, with mode=open, delegatesFocus=false. Should be safelisted.] - expected: FAIL - - [Declarative Shadow DOM as a child of