Re: [whatwg/dom] Provide an AbortSignal that aborts when Nodes become disconnected (Issue #1296)

sorvell left a comment (whatwg/dom#1296)

I'm not sure this is worth adding. Reducing boilerplate and complexity for a common need is a reasonable goal, but common use cases involve the need for distinguishing move v. disconnected and that might itself introduce excessive additional complexity. It would likely be necessary to be able to control the calling of `abort` and at that point, what value is being provided here?

https://github.com/whatwg/dom/issues/1296#issuecomment-2236978733 could potentially be handled by only calling `abort()` on the `disconnectedSignal` if `element.isConnected === false`, thus avoiding any "moves." However, if that's done then one would want a "movedSignal" which is fired in that case so that work that depends on location in the DOM changing could be done (e.g. an event listener on a parent). Such a "moveSignal" would need not to be tied specifically to `moveBefore` since for the noted use case, these are needed for any "movement" mutations. Unfortunately, likely only some "moves" should call abort (e.g. to a different parent but not within the same parent).

Timing is also an issue and a potential performance concern, and the platform already provides MutationObserver to coalesce and provide this information.

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

Message ID: <whatwg/dom/issues/1296/5723090658@github.com>

Received on Friday, 18 September 2026 00:23:10 UTC