Re: [whatwg/dom] MutationObserver needs an equivalent of disconnected & connected callbacks (#533)

Yeah, I think we should just add this. Here's a concrete proposal:

Add boolean `connectedness` to [`MutationObserverInit`](https://dom.spec.whatwg.org/#dictdef-mutationobserverinit), which if set would make the mutation observer start receiving a mutation record whenever the target node is connected to or disconnected from a document.

Add two booleans `becomeConnected` and `becomeDisconnected` to `MutationRecord`. `becomeConnected` is set to true when the target node is newly connected to a document. It's set to false otherwise. Similarly, `becomeDisconnected` is set to true if the target node is newly removed from a document. It's set to false otherwise.

`subtree` option in mutation observer would the observation subtree-wide.

I think there is an option to coalesce the record with the one which inserts / removes the node but a simpler model is to simply create a new mutation record for each.

-- 
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-459246383

Received on Thursday, 31 January 2019 07:39:25 UTC