1
0
Fork 0
firefox/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-scroll-to-center-target.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

26 lines
721 B
HTML

<!DOCTYPE html>
<title>
Ensuring a text directive is scrolled to the center of the view port instead of the top.
</title>
<script src="stash.js"></script>
<script>
function checkScroll() {
const results = {hasScrolled: window.scrollY != 0};
let key = (new URL(document.location)).searchParams.get("key");
stashResultsThenClose(key, results);
};
window.onload = () => {
window.requestAnimationFrame(function() {
window.requestAnimationFrame(checkScroll);
})
}
</script>
<body>
<script>
document.addEventListener("DOMContentLoaded", () => {
// trigger a layout flush
_ = document.body.getBoundingClientRect();
});
</script>
<div style="margin-top: 20vh; margin-bottom: 100vh">Scroll to me</div>
</body>