[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?

(Code snippet from Danny Engelman's [answer](https://stackoverflow.com/a/70426998/5005318) to my Stack Overflow question about this behavior)
````javascript
class myEl extends HTMLElement {}

let el1 = document.createElement("my-el");
let el2 = Object.assign(document.createElement("template"), {
            innerHTML: "<my-el></my-el>"
          }).content.cloneNode(true).querySelector("my-el");

customElements.define("my-el", myEl);

customElements.upgrade(el1); // works as documented
customElements.upgrade(el2); // doesn't upgrade!

console.assert(el1 instanceof myEl, "element not upgraded");
console.assert(el2 instanceof myEl, "template not upgraded");
````

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

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

Received on Wednesday, 22 December 2021 05:43:52 UTC