outdent-indent-inserthorizontalrule-on-selectionchange.html (455B)
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <script> 6 var count = 0; 7 document.addEventListener("DOMContentLoaded", () => { 8 document.onselectionchange = () => { 9 document.execCommand("outdent"); 10 document.execCommand("indent"); 11 document.execCommand("insertHorizontalRule"); 12 if (count++ == 10) { 13 document.onselectionchange = null; 14 } 15 }; 16 find("A"); 17 }); 18 </script> 19 </head> 20 <body><isindex contenteditable> 21 A 22 </body> 23 </html>