tor-browser

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

anchor-inside-iframe.html (909B)


      1 <!DOCTYPE html>
      2 <link rel="help" href="https://drafts.csswg.org/css-scroll-anchoring-1/">
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <iframe width="700" height="500" srcdoc="
      6  <!DOCTYPE html>
      7  <style> body { height: 1000px } div { height: 100px } </style>
      8  <div id='block1'>abc</div>
      9  <div id='block2'>def</div>
     10 "></iframe>
     11 <script>
     12  async_test((t) => {
     13    var iframeWindow = document.querySelector("iframe").contentWindow;
     14    iframeWindow.addEventListener("load", () => {
     15      var block1 = iframeWindow.document.querySelector("#block1");
     16      iframeWindow.scrollTo(0, 150);
     17 
     18      requestAnimationFrame(() => {
     19        step_timeout(() => {
     20          block1.style.height = "200px";
     21          assert_equals(iframeWindow.scrollY, 250);
     22          t.done();
     23        }, 0);
     24      });
     25    });
     26  }, "Scroll anchoring in an iframe.");
     27 </script>