Re: [whatwg/dom] Add cloneable option to ShadowRootInit (Issue #1137)

> Splitting this from [declarative Shadow DOM discussion](https://github.com/whatwg/dom/issues/831). Also see See #892.

See also https://github.com/whatwg/html/pull/5465.

> We should add `cloneable` boolean flag to `ShadowRootInit`, whose default is false. When this flag is set to true, [cloning](https://dom.spec.whatwg.org/#concept-node-clone) of the shadow host will clone the shadow root along with its descendants if _clone children flag_ is set.

I'm supportive of this proposal.



> It's also pretty clear that `element.attachShadow({mode: 'closed', cloneable: true}).cloneNode(true)` should continue to throw because that would result in a shadow root that's not attached to any host whereas `element.attachShadow({[~](mode: 'closed', cloneable: true)}); element.cloneNode(true)` should clone the shadow tree.

Seems reasonable to me, I think. I don't think we should allow direct cloning of the shadow root itself. That's more complicated, and I don't know what the use case is.

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

Message ID: <whatwg/dom/issues/1137/1382588507@github.com>

Received on Friday, 13 January 2023 23:44:56 UTC