Don't clear children of declarative shadow hosts when imperatively attaching another shadow root (#36104)

* 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 <simon.wuelker@arcor.de>

* Update WPT expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-03-23 14:49:45 +01:00 committed by GitHub
parent 3c51df0f1b
commit 3a356ffb74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 1 additions and 107 deletions

View file

@ -562,8 +562,7 @@ impl Element {
}
// Step 4.3.1. Remove all of currentShadowRoots children, in tree order.
let node = self.upcast::<Node>();
for child in node.children() {
for child in current_shadow_root.upcast::<Node>().children() {
child.remove_self();
}

View file

@ -1,102 +0,0 @@
[declarative-shadow-dom-attachment.html]
[Declarative Shadow DOM as a child of <article>, with mode=open, delegatesFocus=false. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <aside>, with mode=open, delegatesFocus=false. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <blockquote>, with mode=open, delegatesFocus=false. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <div>, with mode=open, delegatesFocus=false. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <footer>, with mode=open, delegatesFocus=false. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <h1>, with mode=open, delegatesFocus=false. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <h2>, with mode=open, delegatesFocus=false. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <h3>, with mode=open, delegatesFocus=false. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <h4>, with mode=open, delegatesFocus=false. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <h5>, with mode=open, delegatesFocus=false. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <h6>, with mode=open, delegatesFocus=false. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <header>, with mode=open, delegatesFocus=false. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <main>, with mode=open, delegatesFocus=false. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <nav>, with mode=open, delegatesFocus=false. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <p>, with mode=open, delegatesFocus=false. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <section>, with mode=open, delegatesFocus=false. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <span>, with mode=open, delegatesFocus=false. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <article>, with mode=open, delegatesFocus=true. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <aside>, with mode=open, delegatesFocus=true. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <blockquote>, with mode=open, delegatesFocus=true. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <div>, with mode=open, delegatesFocus=true. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <footer>, with mode=open, delegatesFocus=true. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <h1>, with mode=open, delegatesFocus=true. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <h2>, with mode=open, delegatesFocus=true. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <h3>, with mode=open, delegatesFocus=true. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <h4>, with mode=open, delegatesFocus=true. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <h5>, with mode=open, delegatesFocus=true. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <h6>, with mode=open, delegatesFocus=true. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <header>, with mode=open, delegatesFocus=true. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <main>, with mode=open, delegatesFocus=true. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <nav>, with mode=open, delegatesFocus=true. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <p>, with mode=open, delegatesFocus=true. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <section>, with mode=open, delegatesFocus=true. Should be safelisted.]
expected: FAIL
[Declarative Shadow DOM as a child of <span>, with mode=open, delegatesFocus=true. Should be safelisted.]
expected: FAIL

View file

@ -1,6 +1,3 @@
[declarative-shadow-dom-repeats.html]
[Calling attachShadow() on declarative shadow root must match mode]
expected: FAIL
[Calling attachShadow() on declarative shadow root must match all parameters]
expected: FAIL