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

dead-claudia left a comment (whatwg/dom#533)

Back to the original feature request, I propose a minimal compromise: add a `liveness: true` flag to `MutationObserver`.

[Chromium](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/dom/node.h;l=712;drc=f4cc0c66584f7c6e05a72a3e2ad022df4ff833ba), [Firefox](https://hg-edge.mozilla.org/mozilla-central/file/c606c420560736c2182e2664024067058dd497ae/dom/base/nsINode.h#l811), and [Safari](https://github.com/WebKit/WebKit/blob/62a02c8c5d58aa668ea06379593b65c94b860179/Source/WebCore/dom/Node.h#L430) all three track this via a bit flag on the node itself. And it already needs recursively checked anyways to invoke custom element reactions, so it's not hard to just add a stack of mutation observers to possibly invoke with each node during the pass.

Unobserving nodes is better discussed in https://github.com/whatwg/dom/issues/126. Please, let's keep this on-topic, to avoid spamming everyone's notifications. (I'll admit some fault in contributing to the problem.)

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

Message ID: <whatwg/dom/issues/533/2840007086@github.com>

Received on Tuesday, 29 April 2025 19:28:05 UTC