Re: [w3c/selection-api] Flat Tree or Composed Tree (Issue #336)

(I'd like to document what I have in mind to support flat tree)

We need to introduce `flat-before`, `flat-equal` and `flat-after` algorithms to allow us comparing boundaries in flat tree, and these algorithms will be used to the following API
```
Selection::setBaseAndExtent
Range::setStart/setStartBefore/setStartAfter
Range::setEnd/setEndAfter/setEndBefore
```
So that the `true start` and `true end` that match the visual selection will be stored. 

And we shouldn't change the following APIs because they should remain as is to not break the encapsulation of shadow trees. 
```
Range::isPointInRange
Range::comparePoint/compareBoundaryPoints
Range::intersectsNode
Range::commonAncestorContainer
```
So we probably need a new set of APIs that can expose information across the boundary. Maybe we should introduce a new range call `CrossShadowBoundaryRange` that can only be returned from `getComposedRanges`. This range supports APIs to allow web authors to get results that match the what users see on screen. 


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

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

Received on Thursday, 17 October 2024 18:19:55 UTC