inserthorizontalrule-in-textarea-in-editor-and-undo-on-error-events.html (729B)
1 <!doctype html> 2 <html class="test-wait"> 3 <head> 4 <meta charset="utf-8"> 5 <script> 6 var count = 0; 7 function onError() { 8 if (++count > 2) { 9 document.documentElement.removeAttribute("class"); 10 return; 11 } 12 const object = document.getElementById("a"); 13 const mi = document.getElementById("b"); 14 object.data = ""; 15 object.appendChild(document.getElementById("c")); 16 mi.appendChild(document.getElementById("c")); 17 getSelection().collapse(document.getElementById("c"), 0); 18 document.execCommand("undo"); 19 document.execCommand("insertHorizontalRule"); 20 } 21 </script> 22 </head> 23 <body> 24 <textarea id="c">a</textarea> 25 <dt contenteditable="true"> 26 <mi id="b">#</mi> 27 <object id="a" onerror="onError()"> 28 </object> 29 </dt> 30 </body> 31 </html>