1581246.html (876B)
1 <script> 2 function onLoad() { 3 // For emulating the traditional behavior, collapse Selection to end of the 4 // text node in the <textarea> which is the last child of the <body>. 5 // However, it may be omitted by the parser. Therefore, this test tries to 6 // check the text node, but if it does not exist, uses the <textarea>. 7 const textarea = document.querySelector("textarea"); 8 const textareaOrTextNode = textarea.lastChild ? textarea.lastChild : textarea; 9 getSelection().collapse(textareaOrTextNode, textareaOrTextNode.length); 10 document.querySelector("script").appendChild( 11 document.querySelector("li[contenteditable=false]") 12 ); 13 document.execCommand("indent"); 14 document.execCommand("delete"); 15 } 16 </script> 17 <body onload="onLoad()"> 18 <ul contenteditable> 19 <li contenteditable="false"> 20 <textarea autofocus> 21 </textarea>></li></ul></body>