Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions editing/crashtests/delete-after-removing-first-child.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html id="a">
<script id="b">
window.onload = () => {
document.getSelection().collapse(span1);
const range = document.createRange();
range.setEndBefore(span2);
// This deletes the document element, but leaves behind span 2. The document
// now contains the div with 1 child, which is span 2.
range.deleteContents();
document.execCommand("delete", false, null);
}
</script>
<div contenteditable><span id="span1"></span><span id="span2"></span></div>
29 changes: 29 additions & 0 deletions editing/other/delete-editing-host.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!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>
Loading