Re: [w3c/webcomponents] Composite custom element is not defined until the parent element is connected (#765)

Yes, this was a deliberate decision.

Basically, a parent node relying on its child nodes' state is never sound because the HTML parser can incrementally insert more child nodes, and there is no callback or notification as to when child nodes had finished parsing. In fact, any access to the custom element's child nodes or parents are unsound as the HTML would invoke the custom element constructor on synchronously constructed (as opposed to upgraded) custom elements before it gets inserted into the tree.

Instead, the encouraged patterned is for those child nodes to notify the parent as they become inserted. An alternative approach is to use MutationObserver and take the action whenever your host's child nodes change.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/765#issuecomment-419678006

Received on Saturday, 8 September 2018 22:51:51 UTC