- From: Mason Freed <notifications@github.com>
- Date: Thu, 11 Nov 2021 10:06:48 -0800
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 11 November 2021 18:07:01 UTC
Thanks @spocke - this is a very good point that isn't captured in the current proposal. So currently, `Selection.getRangeAt()` returns a `Range` with `startContainer` always being the left-side of the selection (even for RTL, if seems?), and `endContainer` always being the right side. I am unable to find the place in the [Selection specs](https://w3c.github.io/selection-api) where this behavior is defined, but all browsers seem to agree. I'm wondering if the best way around this would just be to expose the [`direction`](https://w3c.github.io/selection-api/#dfn-direction) directly on the `Selection` object? That wouldn't require changing the definition of `AbstractRange`, and it would even make `getRangeAt()` a bit easier to work with, I think. Something like this: ```javascript const selection = window.getSelection(); const range = selection.getComposedRange(); // As proposed const dir = selection.direction; // "forwards", "backwards", or "directionless" ``` Thoughts? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/WICG/webcomponents/issues/79#issuecomment-966512451
Received on Thursday, 11 November 2021 18:07:01 UTC