tor-browser

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

fixed-position-scroll.html (1359B)


      1 <!doctype html>
      2 <meta name="viewport" content="width=device-width,initial-scale=1">
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="./resources/intersection-observer-test-utils.js"></script>
      6 <div id="target" style="width: 100px; height: 100px; position: fixed; top: 0; left: 0"></div>
      7 <div id="log" style="height: 2000px"></div>
      8 <script>
      9 var entries = [];
     10 
     11 runTestCycle(function() {
     12  var observer = new IntersectionObserver(function(changes) {
     13    entries = entries.concat(changes)
     14  });
     15  observer.observe(target);
     16  entries = entries.concat(observer.takeRecords());
     17  assert_equals(entries.length, 0, 'No initial notifications.');
     18  runTestCycle(step0, 'First rAF.');
     19 }, 'Fixed-position intersection observer on scroll');
     20 
     21 function step0() {
     22  window.scrollTo(0, 1000);
     23  runTestCycle(step1, 'scrollTo(0, 1000)');
     24  checkLastEntry(entries, 0,
     25                 [0, 100, 0, 100, 0, 100, 0, 100, 0,
     26                  document.documentElement.clientWidth, 0, document.documentElement.clientHeight,
     27                  true]);
     28 }
     29 
     30 function step1() {
     31  window.scrollTo(0, 0);
     32  checkLastEntry(entries, 0,
     33                 [0, 100, 0, 100, 0, 100, 0, 100, 0,
     34                  document.documentElement.clientWidth, 0, document.documentElement.clientHeight,
     35                  true]);
     36 }
     37 </script>