Re: [WICG/webcomponents] `customElements.upgrade` does not upgrade node subtrees cloned from `template` contents via `cloneNode` (Issue #946)

> `customElements.upgrade` does not seem to upgrade node subtrees cloned from a `template` element via `cloneNode` in Firefox 95 and Chrome 96. I haven't tested other browsers.
> 
> Is this expected behavior?

Yes, this is expected because `el2`'s document is [**appropriate template contents owner document**](https://html.spec.whatwg.org/multipage/scripting.html#appropriate-template-contents-owner-document) of the document (which is `el1`'s document and where the custom element is defined). In order for upgrade to work, you must call `document.adoptNode` first. Alternatively, you can use `importNode` instead of `cloneNode` and clone the template contents using the correct document.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/946#issuecomment-999322180
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/946/999322180@github.com>

Received on Wednesday, 22 December 2021 06:32:35 UTC