79132962

Date: 2024-10-28 10:28:59
Score: 1
Natty:
Report link

Solution to this problem is quite simple. Just wait until the HTML is parsed, before calling customElements.register. The scheme I normally use when the HTML children have to be processed in connectedCallback: class MyComponent extends HTMLElement{ static { globalThis.addEventListener('load', ()=>{customElements.define('my-component', MyComponent)}); } }

Reasons:
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: G. vdVeen