1645983-2.html (455B)
1 <!doctype html> 2 <div contenteditable>abc<span></span><span></span></div> 3 <script> 4 // For emulating the traditional behavior, collapse Selection to end of the 5 // text node after this <script>. 6 getSelection().collapse( 7 document.body.lastChild, 8 document.body.lastChild.length 9 ); 10 const editingHost = document.querySelector("div[contenteditable]"); 11 getSelection().collapse(editingHost, 3); 12 document.execCommand("insertText", false, " "); 13 </script> 14 </body>