1677566.html (804B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <script> 5 document.addEventListener('DOMContentLoaded', () => { 6 const table = document.querySelector("table"); 7 // For emulating traditional behavior, collapse Selection to end of the 8 // text node after the <p> (<table> does not close the <p>). 9 getSelection().collapse( 10 document.body.lastChild, 11 document.body.lastChild.length 12 ); 13 const paragraph = document.querySelector("p"); 14 document.documentElement.contentEditable = true; 15 getSelection().setBaseAndExtent(document, 0, document.documentElement, 1); 16 paragraph.contentEditable = false; 17 table.insertRow(0); 18 document.execCommand("forwardDelete"); 19 }); 20 </script> 21 </head> 22 <p> 23 <del> 24 <button contenteditable> 25 </button> 26 <table> 27 </table> 28 </del> 29 </p> 30 </body> 31 </html>