Reputation: 3
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
orcreateElementNS
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
Reputation: 21173
Read the answers and comments from this one first:
Then these
Failed to execute 'createElement' on 'Document': The result must not have children
Deferred setAttribute call in Custom Element constructor causes DOM error. Is it a bug?
Upvotes: 1