tor-browser

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

anchoring-with-bounds-clamping.html (785B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <style>
      5 
      6 #changer { height: 1500px; }
      7 #anchor {
      8  width: 150px;
      9  height: 4000px;
     10  background-color: pink;
     11 }
     12 
     13 </style>
     14 <div id="changer"></div>
     15 <div id="anchor"></div>
     16 <script>
     17 
     18 // Test that scroll anchoring interacts correctly with scroll bounds clamping:
     19 // There should be no visible jump even if the content shrinks such that the
     20 // new max scroll position is less than the previous scroll position.
     21 
     22 test(() => {
     23  document.scrollingElement.scrollTop = 1600;
     24  document.querySelector("#changer").style.height = "0";
     25  assert_equals(document.scrollingElement.scrollTop, 100);
     26 }, "Anchoring combined with scroll bounds clamping in the document.");
     27 
     28 </script>