Re: [w3c/webcomponents] connectedCallback timing when the document parser creates custom elements (#551)

@franktopel : The problem then is that the element won't get `connectedCallback` until all children are parsed. For example, if the entire document was a single custom element, that custom element would never receive `connectedCallback` until the entire document is fetched & parsed even though the element is really in the document. That would be bad.

Alternatively, we could add something like `finishedParsingChildrenCallback` but then again, any JS could insert more child nodes after the parse had finished inserting children.

In general, the recommended approach is to either use MutationObserver to observe children being added or removed, or to have a child element notify the parent as it gets inserted. That's the only way a custom element would be able to behave correctly when JS, HTML parser, etc... inserts more children or remove some.

-- 
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/551#issuecomment-429423413

Received on Friday, 12 October 2018 18:48:24 UTC