[w3c/selection-api] getComposedRange() review (Issue #161)

> If [this](https://webidl.spec.whatwg.org/#this) is [empty](https://w3c.github.io/selection-api/#dfn-empty), return a new [StaticRange](https://dom.spec.whatwg.org/#staticrange) whose [start node](https://dom.spec.whatwg.org/#concept-range-start-node) and [end node](https://dom.spec.whatwg.org/#concept-range-end-node) are null and whose [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) and [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) are 0.

Start/end node cannot be null. I think we use some kind of default instead, such as "the body element"?

> While startNode is a [node](https://dom.spec.whatwg.org/#concept-node), startNode's [root](https://dom.spec.whatwg.org/#concept-tree-root) is a [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root), and startNode is not a [shadow-including inclusive ancestor](https://dom.spec.whatwg.org/#concept-shadow-including-inclusive-ancestor) of any of shadowRoots

It seems that if you pass in the `ShadowRoot` instance start node is part of, this wouldn't result in a match. Which if you made a selection inside that `ShadowRoot` instance doesn't seem to be what you want?

---

One thing I'm missing here still is https://github.com/WICG/webcomponents/issues/79#issuecomment-972726532. As we can no longer expose the true range directly we need to deal with that duality somehow, also for existing APIs such as `getRangeAt()`. That will require changes to both DOM and Selection.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/selection-api/issues/161
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/selection-api/issues/161@github.com>

Received on Monday, 19 December 2022 14:30:23 UTC