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

@annevk approved this pull request.

Thanks for fixing this. Let's remove the elaborate notes and put a variant of them in the commit message.

> @@ -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.

I don't think we need the notes either.

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

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

Received on Monday, 2 March 2026 10:25:55 UTC