summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/scroll-to-text-fragment/find-range-from-text-directive-target.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/scroll-to-text-fragment/find-range-from-text-directive-target.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/scroll-to-text-fragment/find-range-from-text-directive-target.html')
-rw-r--r--testing/web-platform/tests/scroll-to-text-fragment/find-range-from-text-directive-target.html78
1 files changed, 78 insertions, 0 deletions
diff --git a/testing/web-platform/tests/scroll-to-text-fragment/find-range-from-text-directive-target.html b/testing/web-platform/tests/scroll-to-text-fragment/find-range-from-text-directive-target.html
new file mode 100644
index 0000000000..dc02ebd874
--- /dev/null
+++ b/testing/web-platform/tests/scroll-to-text-fragment/find-range-from-text-directive-target.html
@@ -0,0 +1,78 @@
+<!doctype html>
+<title>Tests find-a-range-from-a-text-directive algorithm</title>
+<script src="stash.js"></script>
+<script>
+window.didScroll = false;
+
+function checkScroll() {
+ let results = {
+ didScroll: window.scrollY != 0
+ };
+
+ let key = (new URL(document.location)).searchParams.get("key");
+ stashResultsThenClose(key, results);
+}
+
+// Ensure two animation frames on load to test the fallback to element anchor,
+// which gets queued for the next frame if the text fragment is not found.
+window.onload = function() {
+ window.requestAnimationFrame(function() {
+ window.requestAnimationFrame(checkScroll);
+ });
+}
+</script>
+<style>
+ .spacer {
+ width: 50vw;
+ height: 200vh;
+ }
+</style>
+<body>
+ Won't scroll if matched:
+ match suffix
+ match suffix3
+ <div class="spacer"></div>
+ <p>
+ The quick brown fox jumped over the lazy dog.
+ a a b b b c
+ </p>
+ <p>
+ foo foo foo bar bar bar
+ </p>
+ <p>
+ match suffix2
+ prefix match suffix3 matchEnd suffix4 matchEnd suffix5
+ </p>
+ <p>
+ Lorem
+
+ <br> <i> </i>
+ <div> &nbsp </div>
+ <!-- This <p> puts lots of non textual stuff between words -->
+ <div style="display: none">This isn't rendered</div>
+ <div style="visibility: hidden">This also isn't visible</div>
+ <iframe srcdoc="Inner Iframe"></iframe>
+ <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAQAAAAnOwc2AAAAEUlEQVR42mNk+M+AARiHsiAAcCIKAYwFoQ8AAAAASUVORK5CYII=">
+
+ &nbsp; &nbsp Ipsum
+
+ Whitespace
+
+ <br> <i> </i>
+ <div> &nbsp </div>
+ <!-- This <p> puts lots of non textual stuff between words -->
+ <div style="display: none">This isn't rendered</div>
+ <div style="visibility: hidden">This also isn't visible</div>
+ <iframe srcdoc="Inner Iframe"></iframe>
+ <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAQAAAAnOwc2AAAAEUlEQVR42mNk+M+AARiHsiAAcCIKAYwFoQ8AAAAASUVORK5CYII=">
+ &nbsp; &nbsp
+
+ Dipsum
+
+
+
+ </p>
+ <p>
+ This text appears at the end of the document
+ </p
+</body>