Re: [whatwg/dom] Collapse range before mutations in deleteContents and extract (PR #1452)

@zcorpan commented on this pull request.



> @@ -9283,6 +9283,17 @@ method steps are:
     point.
   </ol>
 
+ <li>
+  <p>Set <a>this</a>'s <a for=range>start</a> and <a for=range>end</a> to
+  (<var>newNode</var>, <var>newOffset</var>).
+
+  <p class=note>This is done before performing mutations, because the DOM's built-in
+  <a>live range</a> maintenance mechanisms
+  (<a>live range pre-remove steps</a> and <a>replace data</a> range adjustments)
+  will automatically keep the range valid through the subsequent operations. Collapsing the
+  range after mutations would be unreliable, since script can run during
+  <a for=/>removal</a> and modify the DOM.

"removal" is not a defined term. However I'm not sure this note is needed. @annevk WDYT?

```suggestion
  <a for=/ data-lt=remove>removal</a> and modify the DOM.
```

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

Message ID: <whatwg/dom/pull/1452/review/3859326604@github.com>

Received on Thursday, 26 February 2026 08:36:07 UTC