tor-browser

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

history-restore-anchors.html (1205B)


      1 <link rel="help" href="https://drafts.csswg.org/css-scroll-anchoring/">
      2 
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 
      6 <script>
      7  var win;
      8  var messageCount = 0;
      9  // Navigation steps:
     10  // 1- page gets loaded and anchor element gets scrolled into view.
     11  // 2- loaded page refreshed.
     12  async_test(function(t) {
     13    window.onmessage = function() {
     14      if (++messageCount == 1) {
     15        t.step(() => {
     16          var anchor = win.document.getElementById('anchor');
     17          anchor.scrollIntoView();
     18          assert_equals(win.scrollY, 1000);
     19          win.location.reload();
     20        });
     21      } else {
     22         t.step(() => {
     23            assert_equals(win.scrollY, 1000);
     24            // Change height of content above anchor.
     25            var ch = win.document.getElementById('changer');
     26            ch.style.height = 100;
     27            // Height of first + height changer.
     28            assert_equals(win.scrollY, 1100)
     29            t.done();
     30        });
     31        win.close();
     32      }
     33    };
     34    win = window.open('support/history-restore-anchors-new-window.html');
     35  }, 'Verify scroll anchoring interaction with history restoration');
     36 </script>