| 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 | </style> |
| 13 | |
| 14 | <div id="host"></div> |
| 15 | |
| 16 | <script> |
| 17 | var vw = document.documentElement.clientWidth; |
| 18 | var vh = document.documentElement.clientHeight; |
| 19 | |
| 20 | var entries = []; |
| 21 | var target; |
| 22 | |
| 23 | runTestCycle(function() { |
| 24 | var shadowHost = document.getElementById("host"); |
| 25 | assert_true(!!shadowHost, "Host exists"); |
| 26 | var shadowRoot = shadowHost.createShadowRoot(); |
| 27 | assert_true(!!shadowRoot, "Shadow root exists"); |
| 28 | shadowRoot.innerHTML = "<div id='target' style='width: 100px; height: 100px; background-color: green;'></div>"; |
| 29 | target = shadowRoot.getElementById("target"); |
| 30 | assert_true(!!target, "target exists"); |
| 31 | |
| 32 | var observer = new IntersectionObserver(function(changes) { |
| 33 | entries = entries.concat(changes) |
| 34 | }); |
| 35 | observer.observe(target); |
| 36 | entries = entries.concat(observer.takeRecords()); |
| 37 | assert_equals(entries.length, 0, "No initial notifications."); |
| 38 | runTestCycle(step0, "First rAF after creating shadow DOM."); |
| 39 | }, "Observing a target inside shadow DOM."); |
| 40 | |
| 41 | function step0() { |
| 42 | checkLastEntry(entries, 0, [8, 108, 8, 108, 8, 108, 8, 108, 0, vw, 0, vh, true]); |
| 43 | } |
| 44 | </script> |