summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fenced-frame/resources/frame-with-intersection-observer.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/fenced-frame/resources/frame-with-intersection-observer.html
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/fenced-frame/resources/frame-with-intersection-observer.html')
-rw-r--r--testing/web-platform/tests/fenced-frame/resources/frame-with-intersection-observer.html29
1 files changed, 29 insertions, 0 deletions
diff --git a/testing/web-platform/tests/fenced-frame/resources/frame-with-intersection-observer.html b/testing/web-platform/tests/fenced-frame/resources/frame-with-intersection-observer.html
new file mode 100644
index 0000000000..dd36b20399
--- /dev/null
+++ b/testing/web-platform/tests/fenced-frame/resources/frame-with-intersection-observer.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<script src="/resources/testharness.js"></script>
+<script src="utils.js"></script>
+<div id="target" style="width: 100px; height: 100px; position: fixed; top: 0px; left: 0px"></div>
+<script>
+let next_token = 0;
+function init() {
+ const tokens = parseKeylist();
+ let observer = new IntersectionObserver((entries) => {
+ assert_equals(entries.length, 1);
+ let rect = entries[0].intersectionRect.x + "," +
+ entries[0].intersectionRect.y + "," +
+ entries[0].intersectionRect.width + "," +
+ entries[0].intersectionRect.height + "," +
+ entries[0].isVisible;
+ writeValueToServer(tokens[next_token], rect);
+ next_token = next_token + 1;
+
+ if (next_token == tokens.length) {
+ observer.disconnect();
+ }
+ }, {trackVisibility: true, delay: 100, threshold: [0.6, 0.75]});
+ observer.observe(document.getElementById("target"));
+}
+
+init();
+</script>
+</html>