target-is-root.html (1261B)
1 <!DOCTYPE html> 2 <title>IntersectionObserver when root == target doesn't compute an intersection</title> 3 <meta name="viewport" content="width=device-width,initial-scale=1"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1682915"> 7 <link rel="help" href="https://w3c.github.io/IntersectionObserver/#update-intersection-observations-algo"> 8 <!-- 9 Quoting IntersectionObserver section 3.2.8, "Run the Update Intersection Observations Steps", step 2, substep 3: 10 11 If the intersection root is an Element, and target is not a descendant of 12 the intersection root in the containing block chain, skip to step 11. 13 14 --> 15 <style> 16 #container { 17 overflow: scroll; 18 width: 100px; 19 height: 100px; 20 } 21 </style> 22 <div id=container> 23 <div></div> 24 </div> 25 <script> 26 async_test(function(t) { 27 let container = document.getElementById("container"); 28 let observer = new IntersectionObserver(t.step_func_done(function(entries) { 29 assert_equals(entries.length, 1); 30 assert_equals(entries[0].intersectionRatio, 0); 31 assert_equals(entries[0].isIntersecting, false); 32 }), { root: container }); 33 observer.observe(container); 34 }); 35 </script>