1663725.html (625B)
1 <script> 2 window.onload = () => { 3 // For emulating the traditional behavior, collapse Selection to end of the 4 // <body> (at the text node after the <input>). 5 getSelection().collapse(document.body, document.body.childNodes.length); 6 document.execCommand("insertHorizontalRule"); 7 getSelection().collapse( 8 document.querySelector("b") 9 ); 10 document.execCommand("forwardDelete"); 11 } 12 function onFocusChangeOfInput() { 13 document.getSelection().setPosition(document.querySelector("pre")); 14 } 15 </script> 16 <pre> 17 <time contenteditable>a|</t> 18 <input onfocus="onFocusChangeOfInput()" autofocus onblur="onFocusChangeOfInput()">