Re: [whatwg/dom] Make it possible to observe connected-ness of a node via MutationObserver (#533)

@rniwa here is our update on this:

today, there is no way to observe the synchronous connection and disconnection of a particular element, the only option is MutationObserver (which is async), or registering a custom element (which sometimes it is not an option or overkill).

Just to clarify, in the meeting @domenic mentioned Mutation Events, (e.g.: `DOMNodeInserted` works in all browsers today but does NOT work inside a shadow, and doesn't have the same semantics as connectedCallback). Additionally, `DOMNodeInsertedIntoDoc` does have the same semantics, but does not work in all browsers, neither inside a shadow).

The only real solution today is a very hacky solution, same solution used by us and by the polymer custom element polyfill, which is to patch all DOM APIs that allow you to mutation the childNodes, so you can insertion and removal of elements, to simulate the synchronous connect/disconnect callback semantics.

My question is, can we get a reliable way to listen for this node reaction, synchronous, without registering the element?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/533#issuecomment-491915160

Received on Monday, 13 May 2019 17:32:26 UTC