- From: Ronald Zielaznicki <notifications@github.com>
- Date: Fri, 31 Mar 2023 08:58:36 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/issues/126/1492187798@github.com>
> RonaldZielaznicki looks reasonable. Do we need the callback given `takeRecords()` exists? @annevk We'd need the callback or some other method to remove the records for an individual element. Otherwise a developer wishing to utilize `unobserve` would need to handle the records for every other element that is observed when they remove a single element, which puts us back into the original issue with `disconnect` that `unobserve` is trying to solve. ----- @smaug---- > How does that proposal work with transient observers? Ideally, similar to a call to disconnect. But, disconnect's specification does not reference transient observers. I'm assuming it still does, but I'm relying on a [comment](https://github.com/whatwg/dom/issues/126#issuecomment-163678890) you made back in 2015. So that could have changed. > Say, one has registered a node and observe changes to its subtrees and nodes in subtree moves around so there are transient observers. Are those transient observers removed? Yes, we'd remove those transient observers. > What if there are transient observers because of several different nodes passed earlier to observe(), which all transient observers are removed then? This question is confusing to me because it makes me think we've different understandings of the specification. I want to make sure our understanding aligns. So, please let me know if any of the following given assumptions are incorrect. * the transient registered observers are in a Node's registered observer list; rather than the MutationObserver <sup>1</sup> * given each transient registered observer has a source registered observer<sup>2</sup> Assuming the above is correct, this is how I'd imagine the logic would work: * If the transient registered observer's source is the MutationObserver from which unobserve was called, then we'd remove the transient registered observers from a Node's registered observer list ----- References: 1. [Registered Observer List](https://dom.spec.whatwg.org/#registered-observer-list) - "Each node has a registered observer list (a list of zero or more registered observers), which is initially empty. " 2. [transient registered observer](https://dom.spec.whatwg.org/#transient-registered-observer) - "A transient registered observer is a registered observer that also consists of a source (a registered observer)." -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/126#issuecomment-1492187798 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/issues/126/1492187798@github.com>
Received on Friday, 31 March 2023 15:58:49 UTC