- From: Joe Pea <notifications@github.com>
- Date: Sun, 11 Sep 2022 12:52:49 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/issues/1111/1243031343@github.com>
> The solution in this case, based on the original design intent of `MutationObserver` is that you should be using a single `MutationObserver` to monitor both insertion & removal. There are some issues with that: 1. Once a parent is removed from DOM, it can not have its children independently observed. Having per-element MOs allows that option. https://jsfiddle.net/epo8rhf2 2. This issue, https://github.com/whatwg/dom/issues/126, prevents independent cleanup of `MutationObservers`, making it not yet viable for scenarios where removed parents need to no longer track their children. - Further, point 1 would allow to also observe disconnected parents while still observing a document, although this re-introduces the issue of this thread. 3. One MO could be used for all elements if point 2 is solved, but I believe that also introduces the same issue as this thread. > Using multiple `MutationObservers` and relying on the order of records across them isn't really a use case supported by the design of this API. Right, that's not a current design, but I believe the spec could be updated to behave as described in point 1 of the `Possible Solutions` above. The callbacks would need to be called multiple times per MO, such that it can guarantee that the final result is that all mutations have been executed in order. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/1111#issuecomment-1243031343 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/issues/1111/1243031343@github.com>
Received on Sunday, 11 September 2022 19:53:02 UTC