| Tobias Schneider | 9a6600e | 2017-06-28 17:46:45 | [diff] [blame^] | 1 | <!DOCTYPE html> |
| 2 | <script src="/resources/testharness.js"></script> |
| 3 | <script src="/resources/testharnessreport.js"></script> |
| 4 | <script src="./resources/intersection-observer-test-utils.js"></script> |
| 5 | |
| 6 | <style> |
| 7 | pre, #log { |
| 8 | position: absolute; |
| 9 | top: 0; |
| 10 | left: 200px; |
| 11 | } |
| 12 | #target { |
| 13 | width: 0px; |
| 14 | height: 0px; |
| 15 | position: fixed; |
| 16 | top: -1000px; |
| 17 | } |
| 18 | </style> |
| 19 | |
| 20 | <div id='target'></div> |
| 21 | |
| 22 | <script> |
| 23 | var vw = document.documentElement.clientWidth; |
| 24 | var vh = document.documentElement.clientHeight; |
| 25 | |
| 26 | var entries = []; |
| 27 | |
| 28 | runTestCycle(function() { |
| 29 | var target = document.getElementById('target'); |
| 30 | assert_true(!!target, "target exists"); |
| 31 | var observer = new IntersectionObserver(function(changes) { |
| 32 | entries = entries.concat(changes) |
| 33 | }); |
| 34 | observer.observe(target); |
| 35 | entries = entries.concat(observer.takeRecords()); |
| 36 | assert_equals(entries.length, 0, "No initial notifications."); |
| 37 | runTestCycle(step0, "First rAF."); |
| 38 | }, "A zero-area hidden target should not be intersecting."); |
| 39 | |
| 40 | function step0() { |
| 41 | checkLastEntry(entries, 0, [8, 8, -1000, -1000, 0, 0, 0, 0, 0, vw, 0, vh, false]); |
| 42 | } |
| 43 | </script> |