- From: Ryan Pivovar <notifications@github.com>
- Date: Sat, 22 May 2021 15:15:10 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Saturday, 22 May 2021 22:15:22 UTC
If calling `customElements.get()` returns `undefined`, and if we want to immediately set the custom element afterward, we would have to do something like:
```js
let registeredElement = customElements.get(element);
if (!registeredElement) {
customElementRegistry.define("text-element", Text, { extends: "p" });
registeredElement = customElements.get(element);
}
```
If `CustomElementRegistry.define()` returned the defined element, we could instead do:
```js
let registeredElement = customElements.get(element);
if (!registeredElement) registeredElement = customElementRegistry.define("text-element", Text, { extends: "p" });
```
--
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/927
Received on Saturday, 22 May 2021 22:15:22 UTC