inserthtml-after-temporarily-removing-document-element.html (623B)
1 <!DOCTYPE html> 2 <html class="test-wait"> 3 <head> 4 <meta charset="utf-8"> 5 <title>Testcase for bug 716456 of Mozilla</title> 6 <script> 7 function boom() { 8 const div = document.querySelector("div"); 9 div.contentEditable = "true"; 10 div.focus(); 11 12 const root = document.documentElement; 13 document.removeChild(root); 14 document.appendChild(root); 15 16 setTimeout(() => { 17 getSelection().collapse(div, 0); 18 document.execCommand("inserthtml", false, "a"); 19 setTimeout(() => { 20 document.documentElement.removeAttribute("class"); 21 }, 0); 22 }, 0); 23 } 24 </script> 25 </head> 26 <body onload="boom();"><div></div></body> 27 </html>