blob: 7868adcf967c4983d6371318a27b6d01bf009830 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<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>
|