- From: Euclid Ye <notifications@github.com>
- Date: Tue, 25 Aug 2026 20:42:09 -0700
- To: w3c/selection-api <selection-api@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/selection-api/issues/361@github.com>
yezhizhen created an issue (w3c/selection-api#361)
> [anchor](https://w3c.github.io/selection-api/#dfn-anchor) and [focus](https://w3c.github.io/selection-api/#dfn-focus) of [selection](https://w3c.github.io/selection-api/#dfn-selection) need not to be in the [document tree](https://dom.spec.whatwg.org/#concept-document-tree). It could be in a [shadow tree](https://dom.spec.whatwg.org/#concept-shadow-tree) of the same [document](https://dom.spec.whatwg.org/#document).
However, it also says:
[anchorNode](https://w3c.github.io/selection-api/#dom-selection-anchornode)
The attribute must return the [anchor](https://w3c.github.io/selection-api/#dfn-anchor) [node](https://dom.spec.whatwg.org/#boundary-point-node) of [this](https://webidl.spec.whatwg.org/#this), or null if the [anchor](https://w3c.github.io/selection-api/#dfn-anchor) is null or [anchor](https://w3c.github.io/selection-api/#dfn-anchor) is not in the [document tree](https://dom.spec.whatwg.org/#concept-document-tree).
So `anchorNode` can never be in shadow tree. This is also contradictory to tests:
https://github.com/servo/servo/blob/e83f3117045171e59f230c3b36ebd721826d3754/tests/wpt/tests/selection/shadow-dom/tentative/Selection-isCollapsed.html#L48
--
Reply to this email directly or view it on GitHub:
https://github.com/w3c/selection-api/issues/361
You are receiving this because you are subscribed to this thread.
Message ID: <w3c/selection-api/issues/361@github.com>
Received on Wednesday, 26 August 2026 03:42:13 UTC