tor-browser

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

selection-modify-line-boundary-around-shadow.html (818B)


      1 <!doctype html>
      2 <html class="test-wait">
      3 <head>
      4 <meta charset="utf-8">
      5 <script>
      6 document.addEventListener("DOMContentLoaded", () => {
      7  const shadowRoot = b.attachShadow({mode: "closed"});
      8  shadowRoot.textContent = "A";
      9  getSelection().collapse(shadowRoot.firstChild, 1);
     10 
     11  function moveCaretAndReplaceBodyWithAddress() {
     12    getSelection().modify("move", "forward", "lineboundary");
     13    document.documentElement.replaceChild(a, document.body);
     14  }
     15 
     16  requestAnimationFrame(() => {
     17    requestAnimationFrame(moveCaretAndReplaceBodyWithAddress);
     18    requestAnimationFrame(moveCaretAndReplaceBodyWithAddress);
     19    requestAnimationFrame(
     20      () => document.documentElement.removeAttribute("class")
     21    );
     22  });
     23 }, {once: true});
     24 </script>
     25 </head>
     26 <body>
     27 <address id="a"></address>
     28 <div id="b"></div>
     29 </body>
     30 </html>