explicit-root-different-document.html (874B)
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 <link rel="help" href="https://github.com/w3c/IntersectionObserver/issues/457"> 6 <style> 7 div { 8 width: 100px; 9 height: 100px; 10 background: blue; 11 margin: 10px 12 } 13 </style> 14 <div id="root"></div> 15 <script> 16 let t = async_test("IntersectionObserver reports a (non-intersecting) entry if different-document from the doc"); 17 let doc = document.implementation.createHTMLDocument(""); 18 let target = doc.createElement("div"); 19 doc.body.appendChild(target); 20 new IntersectionObserver( 21 t.step_func_done(function(records) { 22 assert_equals(records.length, 1); 23 assert_false(records[0].isIntersecting); 24 }), 25 { root: document.querySelector("#root") } 26 ).observe(target); 27 </script>