Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<script>
addEventListener("load", () => {
const editingHost = document.querySelector("div[contenteditable]");
// For emulating the traditional behavior, collapse Selection to end of the
// text node in the <div contenteditable> which is the last child of the
// <body>.
getSelection().collapse(editingHost.lastChild, editingHost.lastChild.length);
editingHost.addEventListener("DOMNodeRemoved", () => {
getSelection().collapse(null);
});
document.execCommand("delete");
});
</script>
<div contenteditable>x</link></body>