Re: [w3c/selection-api] Specify the behavior when DOM mutation occurs across shadow-crossing selection (Issue #168)

I think this is essentially what I mentioned in https://github.com/w3c/selection-api/issues/161#issue-1503058584 which references https://github.com/WICG/webcomponents/issues/79#issuecomment-972726532.

Let's think about this a bit:

* We want a new selection live range whose boundary points can be in distinct trees so we can have text selection across the shadow boundary. (Though ultimately they still need to have some kind of shared shadow-including root.)
   * This needs to be updated correctly by the various node tree mutation algorithms.
   * This should not be exposed to script. (Instead we hand out static ranges.)
* We want a selection live range to point back to a `Selection`. Currently `Selection` is mostly defined in terms of a single range, but this might change and it makes sense to let `Selection` be responsible for rendering the range when it changes and such.
   * I guess ideally after each mutation we invoke some kind of "update selection" algorithm, although currently that does not exist.
* Selection needs to be reworked to hold onto this new selection live range and not return it directly.
   * What might be tricky is that if someone accesses `getRange(0)` and manipulates that, this selection live range needs to be updated as well (or perhaps thrown away). We need to be careful not to introduce loops there.

@mfreed7 @rniwa @smaug---- thoughts?

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

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

Received on Monday, 18 September 2023 15:37:36 UTC