- From: James Browning <notifications@github.com>
- Date: Fri, 05 Feb 2021 23:01:14 -0800
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Saturday, 6 February 2021 07:01:27 UTC
An alternative to throwing could be to have a single element name reserved for webcomponents that are not in the global registry e.g. something like `<custom>` or something. When an element is removed from a registry scope it's name would just become `custom`, but otherwise it would behave the same.
e.g.:
```js
const registry = new CustomElementRegistry();
registry.define("foo-bar", FooBarElement);
const shadowRoot = someElement.attachShadow({ registry, mode });
shadowRoot.innerHTML = `<foo-bar baz="qux"></foo-bar>`;
// Inside the shadow root it has it's expected name
const el = shadowRoot.children[0]
el.localName === "foo-bar"; // true
el.remove();
document.body.append(el);
// Inside other roots where FooBarElement is not registered it becomes <custom>
el.localName === "custom"; // true
// <custom> elements created normally would not do anything special and could not be upgraded
const custom = document.createElement("custom");
custom.constructor === HTMLElement; // true
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/907#issuecomment-774414615
Received on Saturday, 6 February 2021 07:01:27 UTC