- From: Anne van Kesteren <notifications@github.com>
- Date: Wed, 07 Oct 2026 22:07:57 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/pull/1507@github.com>
Correct transient registered observer bookkeeping
Since 50b3051 a mutation observer's node list only contains the nodes
passed to observe(), but transient registered observers are added to
nodes being removed. As a result they were never removed: not when
mutation observers are notified, not when observe() replaces the
options of the registered observer they originate from, and not by
disconnect(). In addition, since d34d52d only mutation observers for
which a record was queued are notified, so an observer that only got
transient registered observers, e.g., one observing attributes with
subtree when a child is removed, would not have them removed either.
Track the nodes that have transient registered observers in a new
transient node list and make the observer pending when a transient
registered observer is added for it.
This also:
* Makes the original registered observer the source of a transient
registered observer created from another transient registered
observer, so that observe() removes those as well.
* Makes observe() ignore transient registered observers when looking
for an existing registered observer. Otherwise observing a node that
was just removed from an observed subtree would modify its transient
registered observer, which is removed the next time mutation
observers are notified.
* Makes disconnect() empty the node list.
This matches implementations.
Tests: https://github.com/web-platform-tests/wpt/pull/63390
- [ ] At least two implementers are interested (and none opposed):
* …
* …
- [x] [Tests](https://github.com/web-platform-tests/wpt) are written and can be reviewed and commented upon at:
* https://github.com/web-platform-tests/wpt/pull/63390
- [ ] [Implementation bugs](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) are filed:
* Chromium: …
* Gecko: …
* WebKit: …
* Deno (only for aborting and events): …
* Node.js (only for aborting and events): …
- [ ] [MDN issue](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) is filed: …
- [x] The top of this comment includes a [clear commit message](https://github.com/whatwg/meta/blob/main/COMMITTING.md) to use.
(See [WHATWG Working Mode: Changes](https://whatwg.org/working-mode#changes) for more details.)
You can view, comment on, or merge this pull request online at:
https://github.com/whatwg/dom/pull/1507
-- Commit Summary --
* Correct transient registered observer bookkeeping
-- File Changes --
M dom.bs (74)
-- Patch Links --
https://github.com/whatwg/dom/pull/1507.patch
https://github.com/whatwg/dom/pull/1507.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1507
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/dom/pull/1507@github.com>
Received on Thursday, 8 October 2026 05:08:01 UTC