| <!DOCTYPE html> |
| <div id="root"></div> |
| <script src="../resources/js-test.js"></script> |
| <script> |
| description("Test for observer attribute getters."); |
| var rootDiv = document.getElementById("root"); |
| |
| var observer = new IntersectionObserver(function(e) {}, {}); |
| shouldBeNull("observer.root"); |
| shouldBe("observer.thresholds", "[0]"); |
| shouldBeEqualToString("observer.rootMargin", "0px 0px 0px 0px"); |
| |
| observer = new IntersectionObserver(function(e) {}, { |
| root: rootDiv, |
| threshold: [0, 0.25, 0.5, 1.0], |
| rootMargin: "10% 20px" |
| }); |
| shouldBe("observer.root", "rootDiv"); |
| shouldBe("observer.thresholds", "[0, 0.25, 0.5, 1.0]"); |
| shouldBeEqualToString("observer.rootMargin", "10% 20px 10% 20px"); |
| </script> |