Re: [WICG/webcomponents] add `node.isCustomElement` property (Issue #1080)

Alright, so I opened the console into this very same page, `document.all` seems to produce 2589 elements. 

We can iterate the whole thing with the following and run the suggested `customElement.getName` thing

```js
const start = performance.now()
;[...document.all].forEach(element => {
 for (const attribute of element.attributes) {
  element.isCustomElement
 }
})
console.log('that took', performance.now() - start)
```


Then we can run the following

```js
const start = performance.now()
;[...document.all].forEach(element => {
 for (const attribute of element.attributes) {
  customElements.getName(element.constructor)
 }
})
console.log('that took', performance.now() - start)

```

`customElements.getName` takes around double than an `isCustomElement` check, from a performance point of view, and also provide worse DX and increased code size.



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

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

Received on Wednesday, 16 October 2024 18:22:18 UTC