tor-browser

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

scroll-margin-not-contained.html (1221B)


      1 <!DOCTYPE html>
      2 <meta name="viewport" content="width=device-width,initial-scale=1">
      3 <link rel="help" href="https://www.w3.org/TR/intersection-observer/#dom-intersectionobserver-scrollmargin">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="./resources/intersection-observer-test-utils.js"></script>
      7 
      8 <style>
      9 #scroller { width: 100px; height: 100px; overflow: hidden; background-color: gray; position: absolute; }
     10 #target { width: 50px; height: 50px; background-color: green; }
     11 </style>
     12 
     13 <div id=root>
     14  <div id=scroller>
     15    <div id=target></div>
     16  </div>
     17 </div>
     18 
     19 <script>
     20 let entries = [];
     21 
     22 window.onload = function() {
     23  runTestCycle(testIntersection, "Test scroll margin intersection");
     24 
     25  const observer = new IntersectionObserver(
     26    es => entries = entries.concat(es),
     27    {
     28      root: document.querySelector("#root"),
     29      scrollMargin: "10px"
     30    }
     31  );
     32  observer.observe(target);
     33 };
     34 
     35 function testIntersection() {
     36  assert_equals(entries.length, 1, "IntersectionObserverEntryCount");
     37  // Not insecting because root is not in the containing block chain of target.
     38  assert_false(entries[0].isIntersecting, "isIntersecting");
     39 }
     40 </script>