| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
| 4 <script src="./resources/intersection-observer-test-utils.js"></script> | 4 <script src="./resources/intersection-observer-test-utils.js"></script> |
| 5 | 5 |
| 6 <style> | 6 <style> |
| 7 pre, #log { | 7 pre, #log { |
| 8 position: absolute; | 8 position: absolute; |
| 9 top: 0; | 9 top: 0; |
| 10 left: 200px; | 10 left: 200px; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 target = document.getElementById("target"); | 34 target = document.getElementById("target"); |
| 35 assert_true(!!target, "target exists"); | 35 assert_true(!!target, "target exists"); |
| 36 var root = document.getElementById("root"); | 36 var root = document.getElementById("root"); |
| 37 assert_true(!!root, "root exists"); | 37 assert_true(!!root, "root exists"); |
| 38 var observer = new IntersectionObserver(function(changes) { | 38 var observer = new IntersectionObserver(function(changes) { |
| 39 entries = entries.concat(changes) | 39 entries = entries.concat(changes) |
| 40 }, {root: root}); | 40 }, {root: root}); |
| 41 observer.observe(target); | 41 observer.observe(target); |
| 42 entries = entries.concat(observer.takeRecords()); | 42 entries = entries.concat(observer.takeRecords()); |
| 43 assert_equals(entries.length, 0, "No initial notifications."); | 43 assert_equals(entries.length, 0, "No initial notifications."); |
| 44 runTestCycle(step0, "First rAF should not generate notifications."); | 44 runTestCycle(step0, "First rAF."); |
| 45 }, "Test that border bounding box is used to calculate intersection with a non-s
crolling root."); | 45 }, "Test that border bounding box is used to calculate intersection with a non-s
crolling root."); |
| 46 | 46 |
| 47 function step0() { | 47 function step0() { |
| 48 target.style.transform = "translateY(195px)"; | 48 target.style.transform = "translateY(195px)"; |
| 49 runTestCycle(step1, "target.style.transform = 'translateY(195px)'"); | 49 runTestCycle(step1, "target.style.transform = 'translateY(195px)'"); |
| 50 assert_equals(entries.length, 0, "No notifications after first rAF."); | 50 checkLastEntry(entries, 0, [15, 115, 315, 415, 0, 0, 0, 0, 8, 182, 8, 222, tar
get]); |
| 51 } | 51 } |
| 52 | 52 |
| 53 function step1() { | 53 function step1() { |
| 54 target.style.transform = ""; | 54 target.style.transform = ""; |
| 55 checkLastEntry(entries, 0, [15, 115, 210, 310, 15, 115, 210, 222, 8, 182, 8, 2
22, target]); | 55 checkLastEntry(entries, 1, [15, 115, 210, 310, 15, 115, 210, 222, 8, 182, 8, 2
22, target]); |
| 56 } | 56 } |
| 57 </script> | 57 </script> |
| OLD | NEW |