selection-modify-line-next-to-textarea.html (530B)
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <script> 6 addEventListener("load", () => { 7 getSelection().collapse(document.querySelector("header"), 1); 8 getSelection().modify("move", "backward", "line"); 9 const ruby = document.querySelector("ruby"); 10 ruby.parentElement.replaceChild(document.createElement("h3"), ruby); 11 getSelection().modify("extend", "backward", "character"); 12 }); 13 </script> 14 </head> 15 <body> 16 <textarea> 17 </textarea> 18 <abbr> 19 <header> 20 <select autofocus='false'> 21 <input/> 22 <sup> 23 <ruby id='a'> 24 </body> 25 </html>