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

If I understand this correctly, connected-ness means if a Node appears in the document or not. If so, I'd like to share my use case.
I have a `span` element and I want to mount my application on it when the `span` has been inserted in the document (I cannot control when it will be mounted). If I mount the application on the `span` when it is disconnected, it will throw an error cause most of our code doesn't assume that.

Now I have two choices, attach an event listener of deprecated `DOMNodeInserted` on the `span`, or add a `childList` `MutationObserver` on the whole document then use `document.contains`. I don't know which one hurts the performance mostly and they both don't seem like a good option.

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

Received on Wednesday, 26 May 2021 07:17:38 UTC