insert-image-with-joining-header-element-and-body.html (742B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <script> 5 window.addEventListener("load", () => { 6 const heading = document.getElementById("heading") 7 const input = document.createElementNS("http://www.w3.org/1999/xhtml", "input") 8 heading.appendChild(input) 9 const selection = window.getSelection() 10 const range = new Range() 11 range.setStartBefore(input) 12 heading.contentEditable = true 13 document.execCommand("selectAll", false, null) 14 document.designMode = "on" 15 selection.addRange(range) 16 range.setEndBefore(heading) 17 range.setEndAfter(heading) 18 document.execCommand("insertImage", false, "wss://:pass@[::1]$/") 19 }) 20 </script> 21 </head> 22 <h4 id="heading"></h4> 23 <!-- COMMENT --> 24 </html>