tor-browser

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

forwarddelete-after-editable-slot-element-outside-body.html (882B)


      1 <!doctype html>
      2 <html>
      3 <head>
      4 <meta charset="utf-8">
      5 <script>
      6 document.addEventListener("DOMContentLoaded", () => {
      7  const slot = document.createElement("slot");
      8  document.documentElement.appendChild(slot);
      9  const anchor = document.querySelector("a[contenteditable]");
     10  const selection = document.getSelection()
     11  getSelection().collapse(anchor, 0);
     12  getSelection().setBaseAndExtent(
     13    document, 0,
     14    document.documentElement, document.documentElement.childNodes.length
     15  );
     16  const range = selection.getRangeAt(0);
     17  document.documentElement.contentEditable = true;
     18  document.documentElement.contentEditable = false;
     19  range.collapse(false);
     20  getSelection().removeAllRanges();
     21  getSelection().addRange(range);
     22  document.documentElement.contentEditable = true;
     23  document.execCommand("forwardDelete");
     24 });
     25 </script>
     26 </head><body>
     27 <a contenteditable></a>
     28 </body></html>