Re: [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"?

Why is just returning `null` or throwing an exception like `getRangeAt` not properly here? I feel it's odd that returning a range when there is no range(s). Returning "dummy" range makes web apps need to consider whether it's real one or not.

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

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

Received on Tuesday, 20 December 2022 03:55:57 UTC