- From: Denis Migdal <notifications@github.com>
- Date: Tue, 18 Feb 2025 01:41:05 -0800
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 18 February 2025 09:41:09 UTC
denis-migdal left a comment (WICG/webcomponents#1097)
I just noticed that in the two solutions (template and HTML namespace) :
1. the created `HTMLElement` isn't an `HTMLUnknownElement` (seems also to be the case when built with `.innerHTML`) ;
2. `customElement.upgrade()` has no effect on them if we didn't adopt or insert them in the main document.
I think the (1) behavior is an issue as we might have some code using `instanceof HTMLUnknownElement` to detect unupgraded custom elements. Fortunately, it seems that `:not(:define)` works.
So we need to do something like:
```js
const doc = document.implementation.createDocument(
"http://www.w3.org/1999/xhtml",
"html",
null,
);
function createElement(tagname) {
const elem = doc.createElement(tagname);
document.adoptNode(elem);
return elem;
}
```
--
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/1097#issuecomment-2665092315
You are receiving this because you are subscribed to this thread.
Message ID: <WICG/webcomponents/issues/1097/2665092315@github.com>
Received on Tuesday, 18 February 2025 09:41:09 UTC