4.13.2 Requirements for custom element constructors
…
- The element must not gain any attributes or children, as this violates the expectations of consumers who use the createElement or createElementNS methods.
- In general, work should be deferred to connectedCallback as much as possible—especially work involving fetching resources or rendering. However, note that connectedCallback can be called more than once, so any initialization work that is truly one-time will need a guard to prevent it from running twice.
- In general, the constructor should be used to set up initial state and default values, and to set up event listeners and possibly a shadow root.
ℹ html.spec.whatwg.org