tor-browser

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

fixed-position-child-scroll.html (1381B)


      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 style="position: fixed; top: 0; left: 0">
      7  <div id="target" style="width: 100px; height: 100px"></div>
      8 </div>
      9 <div id="log" style="height: 2000px"></div>
     10 <script>
     11 var entries = [];
     12 
     13 runTestCycle(function() {
     14  var observer = new IntersectionObserver(function(changes) {
     15    entries = entries.concat(changes)
     16  });
     17  observer.observe(target);
     18  entries = entries.concat(observer.takeRecords());
     19  assert_equals(entries.length, 0, 'No initial notifications.');
     20  runTestCycle(step0, 'First rAF.');
     21 }, 'Fixed-position intersection observer on scroll');
     22 
     23 function step0() {
     24  window.scrollTo(0, 1000);
     25  runTestCycle(step1, 'scrollTo(0, 1000)');
     26  checkLastEntry(entries, 0,
     27                 [0, 100, 0, 100, 0, 100, 0, 100, 0,
     28                  document.documentElement.clientWidth, 0, document.documentElement.clientHeight,
     29                  true]);
     30 }
     31 
     32 function step1() {
     33  window.scrollTo(0, 0);
     34  checkLastEntry(entries, 0,
     35                 [0, 100, 0, 100, 0, 100, 0, 100, 0,
     36                  document.documentElement.clientWidth, 0, document.documentElement.clientHeight,
     37                  true]);
     38 }
     39 </script>