Skip to content

Restore deep cloning of shadow root contents.#1480

Merged
annevk merged 1 commit into
whatwg:mainfrom
pwombwell:restore-deep-shadow-clone
Jul 6, 2026
Merged

Restore deep cloning of shadow root contents.#1480
annevk merged 1 commit into
whatwg:mainfrom
pwombwell:restore-deep-shadow-clone

Conversation

@pwombwell

@pwombwell pwombwell commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

This restores the behaviour introduced by #1272.

After #1334, the shadow-root cloning step says to clone each child of the shadow root with subtree set to subtree. When the original call is host.cloneNode(false), that causes each direct child of a clonable shadow root to be cloned shallowly.

That contradicts the behaviour agreed in #1249 / #1272 and the WPT shadow-dom/shadow-root-clonable.html, which expects a clonable shadow root to be cloned in its entirety even when the shadow host is shallow-cloned.


Preview | Diff

This restores the behaviour introduced by whatwg#1272.

After whatwg#1334, the shadow-root cloning step says to clone each child of the shadow root with `subtree` set to `subtree`. When the original call is `host.cloneNode(false)`, that causes each direct child of a clonable shadow root to be cloned shallowly.

That contradicts the behaviour agreed in whatwg#1249 / whatwg#1272 and the WPT `shadow-dom/shadow-root-clonable.html`, which expects a clonable shadow root to be cloned in its entirety even when the shadow host is shallow-cloned.

@annevk annevk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@annevk
annevk merged commit 8f31446 into whatwg:main Jul 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants