Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<body contenteditable=true>x y
<script>
document.body.firstChild.splitText(2) // "x " and " y"
.splitText(1) // "x", " " and " y"
.splitText(1); // "x", "", " " and " y"
getSelection().collapse(document.body, 1);
document.execCommand("forwardDelete");
</script>