Re: [w3c/selection-api] Change Selection to be associated with a composed live range (PR #345)

@domfarolino commented on this pull request.



> @@ -127,6 +128,20 @@ <h2>
         dev do not. We follow Gecko/WebKit, because it lessens the chance of
         getRangeAt(0) throwing.
       </p>
+      <p>To <dfn>reset the range</dfn> of [=this=], given the
+       <a>boundary point</a> <var>start</var> and <a>boundary point</a>
+       <var>end</var>, run these steps:
+      </p>
+      <ol>
+       <li>Let <var>newCachedRange</var> be a new {{Range}} object.</li>
+       <li>[=Range/Set the start=] of <var>newCachedRange</var> to <var>start</var>.
+       </li>
+       <li>[=Range/Set the end=] of <var>newCachedRange</var> to <var>end</var>.</li>
+       <li>Let <var>newRange</var> be a new <a href="TODO">composed live range</a>

We should add a note in this step to indicate that while this looks identical to the above steps, `newCachedRange` and `composed selection range` could actually end up in very different states, because when we update `newCachedRange` we go through the "set the start|end" algorithms which collapse in the cross-root case, while for `composed selection range` we just manually set the members without any algorithm collapsing or anything.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/selection-api/pull/345#pullrequestreview-2642458005
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/selection-api/pull/345/review/2642458005@github.com>

Received on Tuesday, 25 February 2025 21:05:04 UTC