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]")
13 document
.execCommand("indent");
14 document
.execCommand("delete");
17 <body onload=
"onLoad()">
19 <li contenteditable=
"false">
21 </textarea>></li></ul></body>