Automatic update from web-platform-tests script: Fix panic when deleting after range.deleteContents The state of the document after `range.deleteContents` leads to the delete command to traverse to the root element and then crash. Instead, we should simply stop the loop and continue the algorithm and delete backwards. Fixes #44742 Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com> -- wpt-commits: 90dcf72f58187112ae05e381ff5bede587befbf8 wpt-pr: 59670
30 lines
1003 B
HTML
30 lines
1003 B
HTML
<!doctype html>
|
|
<meta charset=utf-8>
|
|
<title>Deletion of full editing host</title>
|
|
<script src=/resources/testharness.js></script>
|
|
<script src=/resources/testharnessreport.js></script>
|
|
<div contenteditable id="empty"></div>
|
|
<div contenteditable id="with-child"><span>Here is a child</span></div>
|
|
<script>
|
|
const emptyDiv = document.getElementById("empty");
|
|
const withChildDiv = document.getElementById("with-child");
|
|
|
|
test(function() {
|
|
document.getSelection().collapse(emptyDiv);
|
|
|
|
assert_true(document.execCommand("delete", false, null));
|
|
|
|
assert_true(emptyDiv.isConnected);
|
|
assert_equals(emptyDiv.innerHTML, "");
|
|
}, "Should not do anything when deleting full editing host");
|
|
|
|
test(function() {
|
|
document.getSelection().collapse(withChildDiv);
|
|
|
|
assert_true(document.execCommand("delete", false, null));
|
|
|
|
assert_true(withChildDiv.isConnected);
|
|
assert_equals(withChildDiv.innerHTML, "<span>Here is a child</span>");
|
|
}, "Should retain all children when deleting full editing host");
|
|
</script>
|