selection-modify-around-input-in-contenteditable.html (427B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <script> 6 addEventListener("load", () => { 7 const selection = window.getSelection(); 8 const range = selection.getRangeAt(0); 9 selection.modify("move", "backward", "character"); 10 selection.addRange(range); 11 }); 12 </script> 13 </head> 14 <body> 15 <fieldset contenteditable spellcheck="true"> 16 <input value="x"> 17 <table> 18 <caption></caption> 19 </table> 20 </fieldset> 21 </body> 22 </html>