ku3b1k0
ku3b1k0

Reputation: 3

Constructor restrictions for Custom Elements in Web Components

In the W3C custom elements spec, it is mentioned that within the Custom element constructor:

The element must not gain any attributes or children, as this violates the expectations of consumers who use the createElement or createElementNS methods.

I am finding it difficult to understand what expectations are we violating. My initial guess was that using createElement to create a custom element does not invoke the Constructor behind the scenes, but that does not seem to be the case based on a proof of concept which I did.

Upvotes: 0

Views: 732

Answers (1)

Related Questions