summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/intersection-observer/resources/intersection-ratio-with-fractional-bounds-in-iframe-content.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/intersection-observer/resources/intersection-ratio-with-fractional-bounds-in-iframe-content.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/intersection-observer/resources/intersection-ratio-with-fractional-bounds-in-iframe-content.html')
-rw-r--r--testing/web-platform/tests/intersection-observer/resources/intersection-ratio-with-fractional-bounds-in-iframe-content.html50
1 files changed, 50 insertions, 0 deletions
diff --git a/testing/web-platform/tests/intersection-observer/resources/intersection-ratio-with-fractional-bounds-in-iframe-content.html b/testing/web-platform/tests/intersection-observer/resources/intersection-ratio-with-fractional-bounds-in-iframe-content.html
new file mode 100644
index 0000000000..696ebf6ebe
--- /dev/null
+++ b/testing/web-platform/tests/intersection-observer/resources/intersection-ratio-with-fractional-bounds-in-iframe-content.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <style>
+ body {
+ margin: 0;
+ height: 100%;
+ }
+ .app {
+ display: flex;
+ width: 100%;
+ }
+ .sidebar {
+ width: 31.1%;
+ margin: 0;
+ background: rgb(231, 249, 139);
+ }
+ section {
+ width: 68.9%;
+ background-color: rgb(119, 219, 172);
+ border: dashed red 3px;
+ }
+ p {
+ margin-top: 0;
+ }
+ </style>
+</head>
+<body>
+ <div class=app>
+ <div class="sidebar"></div>
+ <section id=target>
+ <h2>Observer target</h2>
+ <p><strong>Intersection ratio:</strong> <span id=ratio></span></p>
+ </section>
+ </div>
+
+ <script>
+ const onIntersection = entries => {
+ const ratio = entries[0].intersectionRatio;
+ const eventData = { intersectionRatio: ratio };
+ document.getElementById("ratio").innerText = ratio.toFixed(5);
+ const event = new CustomEvent("iframeObserved", {detail: eventData});
+ parent.document.dispatchEvent(event);
+ };
+ const observer = new IntersectionObserver(onIntersection, {threshold: 1});
+ setTimeout(() => {observer.observe(document.getElementById("target"))}, 0);
+ </script>
+</body>
+</html>