inserthtml-in-li-in-option.html (655B)
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <script> 6 "use strict"; 7 document.addEventListener("DOMContentLoaded", () => { 8 const select = document.querySelector("select"); 9 select.appendChild(document.querySelector("option")); 10 select.appendChild(document.createElement("optgroup")); 11 document.querySelector("p").appendChild(document.querySelector("li[contenteditable]")); 12 getSelection().collapse(document.querySelector("output"), 0); 13 document.execCommand("insertHTML", false, select.innerHTML); 14 }); 15 </script> 16 </head> 17 <body> 18 <dl> 19 <select>a</select> 20 <p></p> 21 <option> 22 <li contenteditable> 23 <output> 24 </output><li></option></dl></body> 25 </html>