Commit 9363c6d
authored
Collapse range before mutations in deleteContents() and extractContents()
Move the step that sets the range's start and end to (newNode, newOffset) from after DOM mutations to before them, in both the deleteContents() and extract algorithms.
The pre-computed collapse target can become invalid if script runs during the remove operation (via "removing steps" hooks) and modifies the DOM. By collapsing the range before mutations, the DOM's built-in live range maintenance mechanisms (live range pre-remove steps and replace data range adjustments) automatically keep the range valid through all subsequent operations.
Fixes #1446.1 parent 3a80353 commit 9363c6d
1 file changed
+6
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9280 | 9280 | | |
9281 | 9281 | | |
9282 | 9282 | | |
| 9283 | + | |
| 9284 | + | |
| 9285 | + | |
9283 | 9286 | | |
9284 | 9287 | | |
9285 | 9288 | | |
| |||
9291 | 9294 | | |
9292 | 9295 | | |
9293 | 9296 | | |
9294 | | - | |
9295 | | - | |
9296 | | - | |
9297 | 9297 | | |
9298 | 9298 | | |
9299 | 9299 | | |
| |||
9411 | 9411 | | |
9412 | 9412 | | |
9413 | 9413 | | |
9414 | | - | |
9415 | | - | |
| 9414 | + | |
| 9415 | + | |
9416 | 9416 | | |
9417 | 9417 | | |
9418 | 9418 | | |
| |||
9495 | 9495 | | |
9496 | 9496 | | |
9497 | 9497 | | |
9498 | | - | |
9499 | | - | |
9500 | | - | |
9501 | 9498 | | |
9502 | 9499 | | |
9503 | 9500 | | |
| |||
11281 | 11278 | | |
11282 | 11279 | | |
11283 | 11280 | | |
| 11281 | + | |
11284 | 11282 | | |
11285 | 11283 | | |
11286 | 11284 | | |
| |||
0 commit comments