Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(574)

Unified Diff: LayoutTests/intersection-observer/root-element-moved.html

Issue 359780043: WIP for IO
Patch Set: Fix inline test while making sure the text test still passes too. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/intersection-observer/root-element-moved.html
diff --git a/LayoutTests/intersection-observer/root-element-moved.html b/LayoutTests/intersection-observer/root-element-moved.html
new file mode 100644
index 0000000000000000000000000000000000000000..3ba877163a585c71a9e8738767ca8dff6526b239
--- /dev/null
+++ b/LayoutTests/intersection-observer/root-element-moved.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<head>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<body>
+
+<div id="root" style="position:absolute">
+ <div id="target" style="width: 100px; height: 100px; background-color: green"></div>
+</div>
+
+<script>
+ var observer;
+ var root = document.getElementById('root');
+ var target = document.getElementById('target');
+ test(function() {
+ observer = new IntersectionObserver(function() {}, { root: document.getElementById('root') });;
+ assert_equals(observer.root, root);
+ observer.observe(target);
+ assert_equals(internals.numberOfActiveIntersectionObservers(document), 1);
+ document.body.appendChild(target);
+ var newDoc = document.implementation.createHTMLDocument('New document');
+ newDoc.body.appendChild(root);
+ assert_equals(internals.numberOfActiveIntersectionObservers(document), 0);
+ assert_equals(internals.numberOfActiveIntersectionObservers(newDoc), 1);
+ document.body.appendChild(root);
+ assert_equals(internals.numberOfActiveIntersectionObservers(document), 1);
+ assert_equals(internals.numberOfActiveIntersectionObservers(newDoc), 0);
+ },"Document's active intersection observers get updated");
+</script>
+</body>
+</html>

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b