- From: Di Zhang <notifications@github.com>
- Date: Tue, 25 Feb 2025 16:18:23 -0800
- To: w3c/selection-api <selection-api@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/selection-api/pull/345/review/2642739735@github.com>
@dizhang168 commented on this pull request. > @@ -546,24 +566,18 @@ <h2> <var>newFocus</var> be the <a>boundary point</a> (<var>node</var>, <var>offset</var>). </li> - <li>Let <var>newRange</var> be a new <a>range</a>. - </li> - <li>If <var>node</var>'s [=tree/root=] is not the same as the - [=this=]'s <a>range</a>'s [=tree/root=], [=Range/set the start=] - <var>newRange</var>'s [=range/start=] and [=range/end=] to - <var>newFocus</var>. + <li>If <var>node</var>'s [=tree/root=] is not the same as + [=this=]'s <a>range</a>'s [=tree/root=], <a>reset the range</a> with + <var>newFocus</var> and <var>newFocus</var>. </li> <li>Otherwise, if <var>oldAnchor</var> is [=boundary point/before=] I prefer option 2, "catch that case early on here, and skip the before/after comparison checks." We will need to update the setBaseAndExtent and extend() functions to check that the boundary points are within the same root before we call "before/after" to "set the start/end". I can think of two easy way to achieve that: 4. If anchor and focus has the same root and anchor is before focus, set range's start to anchor and range's end to focus. 5. Otherwise, set range's start to focus and range's end to anchor. OR 4. If anchor and focus has different roots: 4.1 If anchor is in a shadow tree, set anchor to its shadow host. 4.2 If focus is in a shadow tree, set focus to its shadow host. 5. If anchor is before focus, set range's start to anchor and range's end to focus. 6. Otherwise, set range's start to focus and range's end to anchor. -- Reply to this email directly or view it on GitHub: https://github.com/w3c/selection-api/pull/345#discussion_r1970717697 You are receiving this because you are subscribed to this thread. Message ID: <w3c/selection-api/pull/345/review/2642739735@github.com>
Received on Wednesday, 26 February 2025 00:18:27 UTC