tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

execCommand-without-selection-ranges.html (1494B)


      1 <!doctype html>
      2 <head>
      3 <meta charset="utf-8">
      4 </head>
      5 <body>
      6 <script>
      7 for (const command of [
      8  ["bold", ""],
      9  ["italic", ""],
     10  ["underline", ""],
     11  ["strikethrough", ""],
     12  ["subscript", ""],
     13  ["superscript", ""],
     14  ["cut", ""],
     15  ["copy", ""],
     16  ["paste", ""],
     17  ["delete", ""],
     18  ["forwarddelete", ""],
     19  ["selectall", ""],
     20  ["undo", ""],
     21  ["redo", ""],
     22  ["indent", ""],
     23  ["outdent", ""],
     24  ["backcolor", "#888888"],
     25  ["forecolor", "#888888"],
     26  ["hilitecolor", "#888888"],
     27  ["fontname", "Courier"],
     28  ["fontsize", "6"],
     29  ["increasefontsize", ""],
     30  ["decreasefontsize", ""],
     31  ["inserthorizontalrule", ""],
     32  ["createlink", "foo"],
     33  ["insertimage", "foo"],
     34  ["inserthtml", "foo"],
     35  ["inserttext", "foo"],
     36  ["insertparagraph", ""],
     37  ["gethtml", ""],
     38  ["justifyleft", ""],
     39  ["justifyright", ""],
     40  ["justifycenter", ""],
     41  ["justifyfull", ""],
     42  ["removeformat", ""],
     43  ["unlink", ""],
     44  ["insertorderedlist", ""],
     45  ["insertunorderedlist", ""],
     46  ["formatblock", "h1"],
     47  ["heading", "h1"],
     48  ["stylewithcss", "true"],
     49  ["usecss", "true"],
     50  ["contentreadonly", "true"],
     51  ["readonly", "true"],
     52  ["insertbronreturn", "true"],
     53  ["enableobjectresizing", "true"],
     54  ["enableinlinetableediting", "true"],
     55 ]) {
     56  document.body.innerHTML = "<div contenteditable>abc</div>";
     57  document.querySelector("div[contenteditable]").focus();
     58  getSelection().removeAllRanges();
     59  try {
     60    document.execCommand(command[0], false, command[1]);
     61  } catch(e) {}
     62 }
     63 </script>
     64 </body>
     65 </html>