inserttext-with-clearing-subscript.html (847B)
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <script> 6 document.addEventListener("DOMContentLoaded", () => { 7 getSelection().collapse(document.querySelector("code[contenteditable]").firstChild, 0); 8 window.top.find("A"); 9 document.querySelector("table").insertRow(1); 10 document.querySelector("table").insertRow(1); 11 document.execCommand("subscript"); 12 document.execCommand("foreColor", false, "currentColor"); 13 document.execCommand("insertHTML", false, document.querySelector("h5").outerHTML); 14 document.execCommand("subscript"); 15 document.execCommand("foreColor", false, "currentColor"); 16 document.execCommand("insertHTML", false, document.querySelector("h5").outerHTML); 17 document.execCommand("insertText", false, "A"); 18 }); 19 </script> 20 </head> 21 <body> 22 <table> 23 <tr> 24 <td> 25 <code contenteditable> 26 A 27 <h5> 28 </h5> 29 </code> 30 </body> 31 </html>