- From: Tito <notifications@github.com>
- Date: Wed, 16 Oct 2024 11:22:14 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 16 October 2024 18:22:18 UTC
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