[whatwg/dom] Fix NodeIterator pre-remove steps for ancestors of root (PR #1477)

Generalize the first early-return clause of the `NodeIterator` pre-remove steps so it bails when *toBeRemovedNode* is an inclusive ancestor of *nodeIterator*'s root, not only when it equals the root.

Implementations (Gecko, Blink, WebKit) and the existing [`NodeIterator-removal.html`](https://github.com/web-platform-tests/wpt/blob/master/dom/traversal/NodeIterator-removal.html) WPT test already do this; the prior wording was the source of the seven failures reported in #907 for any implementation that follows the spec literally (e.g. Ladybird).

Reference: #907 (analysis by @bptato).

A companion WPT PR updates a now-misleading comment in the test: web-platform-tests/wpt/pull/PENDING.

(See WHATWG Working Mode: https://whatwg.org/working-mode#changes)

- [x] At least two implementations are interested in implementing this change (already shipped in Gecko, Blink, WebKit).
- [x] At least one of the following changes is also pending:
  - [ ] Tests in [web-platform-tests](https://github.com/web-platform-tests/wpt) (comment update only)
  - [x] No code change required; the new spec text matches deployed implementations.

Closes #907.
You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/dom/pull/1477

-- Commit Summary --

  * Fix NodeIterator pre-remove steps for ancestors of root

-- File Changes --

    M dom.bs (5)

-- Patch Links --

https://github.com/whatwg/dom/pull/1477.patch
https://github.com/whatwg/dom/pull/1477.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1477
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/pull/1477@github.com>

Received on Tuesday, 30 June 2026 15:07:06 UTC