LEFT | RIGHT |
(no file at all) | |
| 1 <!DOCTYPE html> |
| 2 <head> |
| 3 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <body> |
| 6 |
| 7 <div id="root" style="position:absolute"> |
| 8 <div id="target" style="width: 100px; height: 100px; background-color: green
"></div> |
| 9 </div> |
| 10 |
| 11 <script> |
| 12 test(function() { |
| 13 var root = document.getElementById('root'); |
| 14 var observer = new IntersectionObserver(function() {}, { root: document.
getElementById('root') });; |
| 15 var target = document.getElementById('target'); |
| 16 assert_equals(observer.root, root); |
| 17 observer.observe(target); |
| 18 assert_equals(internals.numberOfActiveIntersectionObservers(document), 1
); |
| 19 root.parentNode.removeChild(root); |
| 20 root = null; |
| 21 target = null; |
| 22 GCController.collect(); |
| 23 assert_equals(observer.root, null); |
| 24 assert_equals(internals.numberOfActiveIntersectionObservers(document), 0
); |
| 25 }, "IntersectionObserver doesn't keep unreachable root alive"); |
| 26 </script> |
| 27 </body> |
| 28 </html> |
LEFT | RIGHT |