tor-browser

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

collapse-selection-into-editing-host-during-blur-of-input-ref.html (724B)


      1 <!doctype html>
      2 <html class="reftest-wait">
      3 <meta charset="utf-8">
      4 <title>Move Selection into an editing host before TextEditor gets blur event</title>
      5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6 <style>
      7  div[contenteditable] {
      8    outline: none;
      9  }
     10  input {
     11    border: none;
     12    outline: none;
     13  }
     14 </style>
     15 <script>
     16 SimpleTest.waitForFocus(() => {
     17  const editingHost = document.querySelector("div[contenteditable]");
     18  editingHost.addEventListener("focus", () => {
     19    requestAnimationFrame(
     20      () => document.documentElement.removeAttribute("class")
     21    );
     22  }, { once: true });
     23  getSelection().collapse(editingHost, 0);
     24 });
     25 </script>
     26 <input>
     27 <div contenteditable="true" spellcheck="false"><br></div>