Skip to content

Commit 89d61c2

Browse files
mrobinsonservo-wpt-sync
authored andcommitted
script: Avoid double adjustment of Selection ranges during contenteditable node movement
The editing specification has a different way of updating selection ranges than the typical live range update method in the `insert` and `remove` algorithms. Because selections are currently represented as live ranges (something that will change soon), this means that the adjustment was being applied twice: once by the live range update and then once by the `contenteditable` code's range fixup. This change makes it so that the `contenteditable` fixup runs against the original selection boundaries, meaning that the final fixup is done only once. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
1 parent 6745634 commit 89d61c2

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<link rel="help" href="https://github.com/servo/servo/issues/47333">
3+
<script>
4+
function main() {
5+
window.getSelection().selectAllChildren(div);
6+
document.execCommand("removeFormat");
7+
document.execCommand("insertHorizontalRule");
8+
}
9+
</script>
10+
<body onload="main()" contenteditable="">
11+
<div id="div"><b>

0 commit comments

Comments
 (0)