move-first-element-from-editinghost-to-outside-on-input-of-embolden.html (546B)
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <script> 6 addEventListener("load", () => { 7 document.querySelector("ol").addEventListener("input", () => { 8 const inlineEditingHost = document.querySelector("span[contenteditable]"); 9 const iter = document.createNodeIterator(inlineEditingHost, NodeFilter.SHOW_ELEMENT); 10 iter.nextNode().before(inlineEditingHost); 11 }); 12 document.execCommand("selectAll"); 13 document.execCommand("bold"); 14 }); 15 </script> 16 </head> 17 <body> 18 <ol> 19 <span contenteditable> 20 <h6></h6> 21 </span></ol></body> 22 </html>