Re: [whatwg/dom] Add definition for composed selection range (PR #1342)

@domfarolino commented on this pull request.



>       <li>Set <var>range</var>'s
      <a for=range>start</a> to <var>bp</var>.
+
+     <li>If <var>selection range</var> is not null,
+     set <var>selection range</var>’s
+     <a for="range">start</a> to <var>bp</var>.

This is interesting because we're _always_ propagating changes from the internal live range up to the composed selection range. Imagine a scenario where the composed selection range's start is in the light DOM while its end is in the shadow DOM—`getSelection().setBaseAndExtent(light, 0, shadow, 0)`. In this case, the composed selection range's _legacy live range_ will be collapsed in the shadow DOM. I think what we have here in the spec is fine, but it's worth pointing out that moving the internal live range's start node around in the shadow dom _will_ drag the composed live range's start node down into the shadow DOM with it, which could be surprising to people that would expect the composed selection range to not change shadow roots if it doesn't have to (i.e., some might expect the two ranges to move freely with respect to each other).

I think the model we've landed on here is the simplest, but I just wanted to point it out since this case was mentioned by schenney on the WHATNOT call.

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

Message ID: <whatwg/dom/pull/1342/review/2584641036@github.com>

Received on Thursday, 30 January 2025 18:39:57 UTC