Re: [whatwg/dom] How should `clonable` work in `cloneNode(false)`? (Issue #1249)

> Does anyone know what Blink and WebKit do?

Blink does not clone the shadow root **at all** for `cloneNode(false)`, at least currently.

> Or so will throw after cloning if we clone the shadow tree. Maybe fine? You kinda need to deal with that for moves inside the document.

This is a good point. I'm really starting to think general `clonable` shadow roots in the main page might cause more problems than they solve. At the very least we need https://github.com/whatwg/html/issues/10107 resolved.

But it sounds like we have rough consensus that modulo the other `clonable` issues, `cloneNode(false)` should deep-clone the shadow root. That's nice because that's actually already what the [spec says](https://dom.spec.whatwg.org/#concept-node-clone-ext:~:text=s%20declarative.-,If%20the%20clone%20children%20flag%20is%20set%2C%20then%20for%20each,-child%20child%20of):

> 7.3 If the clone children flag is set, then for each [child](https://dom.spec.whatwg.org/#concept-tree-child) child of node’s [shadow root](https://dom.spec.whatwg.org/#concept-element-shadow-root), in [tree order](https://dom.spec.whatwg.org/#concept-tree-order): [append](https://dom.spec.whatwg.org/#concept-node-append) the result of [cloning](https://dom.spec.whatwg.org/#concept-node-clone) child with document **and the clone children flag set**, to copy’s [shadow root](https://dom.spec.whatwg.org/#concept-element-shadow-root).

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1249#issuecomment-1917772229
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/1249/1917772229@github.com>

Received on Tuesday, 30 January 2024 19:47:35 UTC