mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1045754 - Part 2 - Tests. r=bz
- Updated smooth scroll behavior mochitest and reftests to match new CSSOM-View DOM scrolling method parameters. - Added tests for Element.ScrollBy and Element.ScrollTo.
This commit is contained in:
parent
96c33a1fa3
commit
ad10b6549b
@ -58,7 +58,7 @@
|
||||
ok(window.scrollX == 15 && window.scrollY == 16,
|
||||
"instant scroll-behavior must be synchronous when setting new position");
|
||||
|
||||
window.scrollTo(100, 200, {behavior: 'smooth'});
|
||||
window.scrollTo({left: 100, top: 200, behavior: 'smooth'});
|
||||
ok(window.scrollX == 15 && window.scrollY == 16,
|
||||
"smooth scroll-behavior must be asynchronous");
|
||||
|
||||
@ -238,7 +238,7 @@
|
||||
waitForAllPaintsFlushed(function() {
|
||||
|
||||
window.scrollTo(startX, startY);
|
||||
window.scrollTo(endX, endY, {behavior: 'smooth'});
|
||||
window.scrollTo({left: endX, top: endY, behavior: 'smooth'});
|
||||
|
||||
var currentTime = 0; // ms
|
||||
|
||||
|
@ -14,6 +14,8 @@ skip-if(Android) pref(layout.css.scroll-behavior.enabled,true) pref(layout.css.s
|
||||
skip-if(Android) pref(layout.css.scroll-behavior.enabled,true) pref(layout.css.scroll-behavior.property-enabled,true) == scroll-behavior-3.html scroll-behavior-3.html?ref # see bug 1041833
|
||||
skip-if(Android) pref(layout.css.scroll-behavior.enabled,true) pref(layout.css.scroll-behavior.property-enabled,true) == scroll-behavior-4.html scroll-behavior-4.html?ref # see bug 1041833
|
||||
skip-if(Android) pref(layout.css.scroll-behavior.enabled,true) pref(layout.css.scroll-behavior.property-enabled,true) == scroll-behavior-5.html scroll-behavior-5.html?ref # see bug 1041833
|
||||
skip-if(Android) pref(layout.css.scroll-behavior.enabled,true) pref(layout.css.scroll-behavior.property-enabled,true) == scroll-behavior-6.html scroll-behavior-6.html?ref # see bug 1041833
|
||||
skip-if(Android) pref(layout.css.scroll-behavior.enabled,true) pref(layout.css.scroll-behavior.property-enabled,true) == scroll-behavior-7.html scroll-behavior-7.html?ref # see bug 1041833
|
||||
skip-if(B2G&&browserIsRemote) HTTP == simple-1.html simple-1.html?ref
|
||||
skip-if(B2G) HTTP == subpixel-1.html#d subpixel-1-ref.html#d
|
||||
fuzzy-if(Android,4,120) HTTP == text-1.html text-1.html?ref
|
||||
|
@ -43,12 +43,12 @@
|
||||
<script>
|
||||
function doTest() {
|
||||
if (document.location.search != '?ref') {
|
||||
window.scrollTo(500, 500);
|
||||
window.scrollTo(window.scrollX, window.scrollY);
|
||||
window.scrollTo({left: 500, top: 500});
|
||||
window.scrollTo({left: window.scrollX, top: window.scrollY});
|
||||
}
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
window.scrollTo(0,0, {behavior: "instant"});
|
||||
window.scrollTo({left: 0, top: 0, behavior: "instant"});
|
||||
window.addEventListener("MozReftestInvalidate", doTest, false);
|
||||
</script>
|
||||
</body>
|
||||
|
@ -37,7 +37,7 @@
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
#scroll_1, #scroll_2, #scroll_3 {
|
||||
#scroll_1, #scroll_2, #scroll_3, #scroll_7 {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
@ -76,18 +76,23 @@
|
||||
<div id="box6a" class="a_box"></div>
|
||||
<div id="box6b" class="another_box"></div>
|
||||
</div>
|
||||
<div id="scroll_7" class="scroll_box">
|
||||
<div id="box7a" class="a_box"></div>
|
||||
<div id="box7b" class="another_box"></div>
|
||||
</div>
|
||||
<script>
|
||||
function doTest() {
|
||||
if (document.location.search != '?ref') {
|
||||
document.getElementById("box1b").scrollIntoView(false);
|
||||
document.getElementById("box2b").scrollIntoView(false, {behavior: "auto"});
|
||||
document.getElementById("box3b").scrollIntoView(false, {behavior: "smooth"});
|
||||
document.getElementById("box4b").scrollIntoView(false, {behavior: "smooth"});
|
||||
document.getElementById("box5b").scrollIntoView(false, {behavior: "smooth"});
|
||||
document.getElementById("box6b").scrollIntoView(false, {behavior: "smooth"});
|
||||
document.getElementById("box1b").scrollIntoView({block: "end"});
|
||||
document.getElementById("box2b").scrollIntoView({block: "end", behavior: "auto"});
|
||||
document.getElementById("box3b").scrollIntoView({block: "end", behavior: "smooth"});
|
||||
document.getElementById("box4b").scrollIntoView({block: "end", behavior: "smooth"});
|
||||
document.getElementById("box5b").scrollIntoView({block: "end", behavior: "smooth"});
|
||||
document.getElementById("box6b").scrollIntoView({block: "end", behavior: "smooth"});
|
||||
document.getElementById("box7b").scrollIntoView(false);
|
||||
|
||||
// Interrupt any smooth scrolling
|
||||
for (var i=1; i <= 6; i++) {
|
||||
for (var i=1; i <= 7; i++) {
|
||||
document.getElementById("scroll_" + i).scrollLeft
|
||||
= document.getElementById("scroll_" + i).scrollLeft;
|
||||
document.getElementById("scroll_" + i).scrollTop
|
||||
@ -96,9 +101,9 @@
|
||||
}
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
for (var i=1; i <= 6; i++) {
|
||||
for (var i=1; i <= 7; i++) {
|
||||
document.getElementById("box" + i + "a")
|
||||
.scrollIntoView(true, {behavior: "instant"});
|
||||
.scrollIntoView({block: "start", behavior: "instant"});
|
||||
}
|
||||
window.addEventListener("MozReftestInvalidate", doTest, false);
|
||||
</script>
|
||||
|
@ -37,11 +37,11 @@
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
#scroll_2, #scroll_6, #scroll_9 {
|
||||
#scroll_2, #scroll_6, #scroll_9, #scroll_12 {
|
||||
scroll-behavior: auto;
|
||||
}
|
||||
|
||||
#scroll_1, #scroll_5, #scroll_8 {
|
||||
#scroll_1, #scroll_5, #scroll_8, #scroll_11 {
|
||||
scroll-behavior: instant;
|
||||
}
|
||||
|
||||
@ -96,42 +96,57 @@
|
||||
<div id="box11a" class="a_box"></div>
|
||||
<div id="box11b" class="another_box"></div>
|
||||
</div>
|
||||
<div id="scroll_12" class="scroll_box">
|
||||
<div id="box12a" class="a_box"></div>
|
||||
<div id="box12b" class="another_box"></div>
|
||||
</div>
|
||||
<div id="scroll_13" class="scroll_box">
|
||||
<div id="box13a" class="a_box"></div>
|
||||
<div id="box13b" class="another_box"></div>
|
||||
</div>
|
||||
<div id="scroll_14" class="scroll_box">
|
||||
<div id="box14a" class="a_box"></div>
|
||||
<div id="box14b" class="another_box"></div>
|
||||
</div>
|
||||
<script>
|
||||
function doTest() {
|
||||
if (document.location.search != '?ref') {
|
||||
document.getElementById("box1b").scrollIntoView(false);
|
||||
document.getElementById("box2b").scrollIntoView(false);
|
||||
document.getElementById("box3b").scrollIntoView(false);
|
||||
document.getElementById("box4b").scrollIntoView(false, {behavior: "instant"});
|
||||
document.getElementById("box5b").scrollIntoView(false, {behavior: "instant"});
|
||||
document.getElementById("box6b").scrollIntoView(false, {behavior: "instant"});
|
||||
document.getElementById("box7b").scrollIntoView(false, {behavior: "instant"});
|
||||
document.getElementById("box8b").scrollIntoView(false, {behavior: "auto"});
|
||||
document.getElementById("box9b").scrollIntoView(false, {behavior: "auto"});
|
||||
document.getElementById("box10b").scrollIntoView(false, {behavior: "auto"});
|
||||
document.getElementById("box1b").scrollIntoView({block: "end"});
|
||||
document.getElementById("box2b").scrollIntoView({block: "end"});
|
||||
document.getElementById("box3b").scrollIntoView({block: "end"});
|
||||
document.getElementById("box4b").scrollIntoView({block: "end", behavior: "instant"});
|
||||
document.getElementById("box5b").scrollIntoView({block: "end", behavior: "instant"});
|
||||
document.getElementById("box6b").scrollIntoView({block: "end", behavior: "instant"});
|
||||
document.getElementById("box7b").scrollIntoView({block: "end", behavior: "instant"});
|
||||
document.getElementById("box8b").scrollIntoView({block: "end", behavior: "auto"});
|
||||
document.getElementById("box9b").scrollIntoView({block: "end", behavior: "auto"});
|
||||
document.getElementById("box10b").scrollIntoView({block: "end", behavior: "auto"});
|
||||
document.getElementById("box11b").scrollIntoView(false);
|
||||
document.getElementById("box12b").scrollIntoView(false);
|
||||
document.getElementById("box13b").scrollIntoView(false);
|
||||
|
||||
// Scroll_11 is a control, expected to scroll smoothly
|
||||
document.getElementById("box11b").scrollIntoView(false, {behavior: "smooth"});
|
||||
// Scroll_14 is a control, expected to scroll smoothly
|
||||
document.getElementById("box14b").scrollIntoView({block: "end", behavior: "smooth"});
|
||||
|
||||
// Interrupt any smooth scrolling
|
||||
for (var i=1; i <= 11; i++) {
|
||||
for (var i=1; i <= 14; i++) {
|
||||
document.getElementById("scroll_" + i).scrollLeft
|
||||
= document.getElementById("scroll_" + i).scrollLeft;
|
||||
document.getElementById("scroll_" + i).scrollTop
|
||||
= document.getElementById("scroll_" + i).scrollTop;
|
||||
}
|
||||
} else {
|
||||
// Scroll all boxes except box 11
|
||||
for (var i=1; i <= 10; i++) {
|
||||
document.getElementById("box" + i + "b").scrollIntoView(false, {behavior: "instant"});
|
||||
// Scroll all boxes except box 14
|
||||
for (var i=1; i <= 13; i++) {
|
||||
document.getElementById("box" + i + "b").scrollIntoView({block: "end", behavior: "instant"});
|
||||
}
|
||||
}
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
|
||||
for (var i=1; i <= 11; i++) {
|
||||
for (var i=1; i <= 14; i++) {
|
||||
document.getElementById("box" + i + "a")
|
||||
.scrollIntoView(true, {behavior: "instant"});
|
||||
.scrollIntoView({block: "start", behavior: "instant"});
|
||||
}
|
||||
|
||||
window.addEventListener("MozReftestInvalidate", doTest, false);
|
||||
|
@ -78,7 +78,7 @@
|
||||
window.location.hash = "test_anchor_3";
|
||||
|
||||
// Scroll_4 is expected to scroll smoothly
|
||||
document.getElementById("box4b").scrollIntoView(false, {behavior: "smooth"});
|
||||
document.getElementById("box4b").scrollIntoView({block: "end", behavior: "smooth"});
|
||||
|
||||
// Interrupt any smooth scrolling
|
||||
for (var i=1; i <= 4; i++) {
|
||||
@ -89,7 +89,7 @@
|
||||
}
|
||||
} else {
|
||||
for (var i=1; i <= 3; i++) {
|
||||
document.getElementById("box" + i + "b").scrollIntoView(false, {behavior: "instant"});
|
||||
document.getElementById("box" + i + "b").scrollIntoView({block: "end", behavior: "instant"});
|
||||
}
|
||||
}
|
||||
document.documentElement.removeAttribute("class");
|
||||
@ -97,7 +97,7 @@
|
||||
|
||||
for (var i=1; i <= 4; i++) {
|
||||
document.getElementById("box" + i + "a")
|
||||
.scrollIntoView(true, {behavior: "instant"});
|
||||
.scrollIntoView({block: "start", behavior: "instant"});
|
||||
}
|
||||
|
||||
window.addEventListener("MozReftestInvalidate", doTest, false);
|
||||
|
@ -37,15 +37,15 @@
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
#scroll_2 {
|
||||
#scroll_2, #scroll_5 {
|
||||
scroll-behavior: auto;
|
||||
}
|
||||
|
||||
#scroll_3 {
|
||||
#scroll_3, #scroll_6 {
|
||||
scroll-behavior: instant;
|
||||
}
|
||||
|
||||
#scroll_4 {
|
||||
#scroll_7, #scroll_8 {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
@ -68,40 +68,53 @@
|
||||
<div id="box4a" class="a_box"></div>
|
||||
<div id="box4b" class="another_box"></div>
|
||||
</div>
|
||||
<div id="scroll_5" class="scroll_box">
|
||||
<div id="box5a" class="a_box"></div>
|
||||
<div id="box5b" class="another_box"></div>
|
||||
</div>
|
||||
<div id="scroll_6" class="scroll_box">
|
||||
<div id="box6a" class="a_box"></div>
|
||||
<div id="box6b" class="another_box"></div>
|
||||
</div>
|
||||
<div id="scroll_7" class="scroll_box">
|
||||
<div id="box7a" class="a_box"></div>
|
||||
<div id="box7b" class="another_box"></div>
|
||||
</div>
|
||||
<div id="scroll_8" class="scroll_box">
|
||||
<div id="box8a" class="a_box"></div>
|
||||
<div id="box8b" class="another_box"></div>
|
||||
</div>
|
||||
<script>
|
||||
function doTest() {
|
||||
if (document.location.search != '?ref') {
|
||||
// Expect instantaneous scroll:
|
||||
document.getElementById("scroll_1").scrollLeft = 0;
|
||||
document.getElementById("scroll_1").scrollTop = 0;
|
||||
document.getElementById("scroll_2").scrollLeft = 0;
|
||||
document.getElementById("scroll_2").scrollTop = 0;
|
||||
document.getElementById("scroll_3").scrollLeft = 0;
|
||||
document.getElementById("scroll_3").scrollTop = 0;
|
||||
document.getElementById("scroll_1").scrollTo({left: 0, top: 0});
|
||||
document.getElementById("scroll_2").scrollTo({left: 0, top: 0});
|
||||
document.getElementById("scroll_3").scrollTo({left: 0, top: 0});
|
||||
document.getElementById("scroll_4").scrollTo(0, 0);
|
||||
document.getElementById("scroll_5").scrollTo(0, 0);
|
||||
document.getElementById("scroll_6").scrollTo(0, 0);
|
||||
|
||||
// Expect smooth scroll:
|
||||
document.getElementById("scroll_4").scrollLeft = 0;
|
||||
document.getElementById("scroll_4").scrollTop = 0;
|
||||
document.getElementById("scroll_7").scrollTo({left: 0, top: 0});
|
||||
document.getElementById("scroll_8").scrollTo(0, 0);
|
||||
|
||||
// Interrupt any smooth scrolling
|
||||
for (var i=1; i <= 4; i++) {
|
||||
document.getElementById("scroll_" + i).scrollLeft
|
||||
= document.getElementById("scroll_" + i).scrollLeft;
|
||||
document.getElementById("scroll_" + i).scrollTop
|
||||
= document.getElementById("scroll_" + i).scrollTop;
|
||||
for (var i=1; i <= 8; i++) {
|
||||
document.getElementById("scroll_" + i).scrollTo();
|
||||
}
|
||||
} else {
|
||||
// Scroll all boxes except for box4a
|
||||
for (var i=1; i <= 3; i++) {
|
||||
document.getElementById("box" + i + "a").scrollIntoView(false, {behavior: "instant"});
|
||||
// Scroll all boxes except for box7a and box8a
|
||||
for (var i=1; i <= 6; i++) {
|
||||
document.getElementById("box" + i + "a").scrollIntoView({block: "end", behavior: "instant"});
|
||||
}
|
||||
}
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
|
||||
for (var i=1; i <= 4; i++) {
|
||||
for (var i=1; i <= 8; i++) {
|
||||
document.getElementById("box" + i + "b")
|
||||
.scrollIntoView(true, {behavior: "instant"});
|
||||
.scrollIntoView({block: "start", behavior: "instant"});
|
||||
}
|
||||
|
||||
window.addEventListener("MozReftestInvalidate", doTest, false);
|
||||
|
145
layout/reftests/scrolling/scroll-behavior-6.html
Normal file
145
layout/reftests/scrolling/scroll-behavior-6.html
Normal file
@ -0,0 +1,145 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Testcase for bug 1010538 - Element.ScrollBy and Element.ScrollTo</title>
|
||||
<style type="text/css">
|
||||
|
||||
html,body {
|
||||
color: black;
|
||||
background-color: white;
|
||||
font-size: 16px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.a_box {
|
||||
position: relative;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background: blue;
|
||||
}
|
||||
|
||||
.another_box {
|
||||
position: relative;
|
||||
left: 2000px;
|
||||
top: 2000px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background: green;
|
||||
}
|
||||
|
||||
.scroll_box {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="scroll_1" class="scroll_box">
|
||||
<div id="box1a" class="a_box"></div>
|
||||
<div id="box1b" class="another_box"></div>
|
||||
</div>
|
||||
<div id="scroll_2" class="scroll_box">
|
||||
<div id="box2a" class="a_box"></div>
|
||||
<div id="box2b" class="another_box"></div>
|
||||
</div>
|
||||
<div id="scroll_3" class="scroll_box">
|
||||
<div id="box3a" class="a_box"></div>
|
||||
<div id="box3b" class="another_box"></div>
|
||||
</div>
|
||||
<div id="scroll_4" class="scroll_box">
|
||||
<div id="box4a" class="a_box"></div>
|
||||
<div id="box4b" class="another_box"></div>
|
||||
</div>
|
||||
<div id="scroll_5" class="scroll_box">
|
||||
<div id="box5a" class="a_box"></div>
|
||||
<div id="box5b" class="another_box"></div>
|
||||
</div>
|
||||
<div id="scroll_6" class="scroll_box">
|
||||
<div id="box6a" class="a_box"></div>
|
||||
<div id="box6b" class="another_box"></div>
|
||||
</div>
|
||||
<div id="scroll_7" class="scroll_box">
|
||||
<div id="box7a" class="a_box"></div>
|
||||
<div id="box7b" class="another_box"></div>
|
||||
</div>
|
||||
<div id="scroll_8" class="scroll_box">
|
||||
<div id="box8a" class="a_box"></div>
|
||||
<div id="box8b" class="another_box"></div>
|
||||
</div>
|
||||
<div id="scroll_9" class="scroll_box">
|
||||
<div id="box9a" class="a_box"></div>
|
||||
<div id="box9b" class="another_box"></div>
|
||||
</div>
|
||||
<div id="scroll_10" class="scroll_box">
|
||||
<div id="box10a" class="a_box"></div>
|
||||
<div id="box10b" class="another_box"></div>
|
||||
</div>
|
||||
<script>
|
||||
function doTest() {
|
||||
if (document.location.search != '?ref') {
|
||||
document.getElementById("scroll_1").scrollTo({left: 5, top: 0});
|
||||
document.getElementById("scroll_2").scrollTo({left: 0, top: 5});
|
||||
document.getElementById("scroll_3").scrollTo({left: 5, top: 5});
|
||||
document.getElementById("scroll_4").scrollTo({left: 5, top: 5});
|
||||
document.getElementById("scroll_5").scrollTo({left: 0, top: 0});
|
||||
document.getElementById("scroll_6").scrollTo(0, 5);
|
||||
document.getElementById("scroll_7").scrollTo(5, 0);
|
||||
document.getElementById("scroll_8").scrollTo(0, 5);
|
||||
document.getElementById("scroll_9").scrollTo(5, 5);
|
||||
document.getElementById("scroll_10").scrollTo(0, 0);
|
||||
} else {
|
||||
document.getElementById("scroll_1").scrollTo({left: 0, top: 0});
|
||||
document.getElementById("scroll_1").scrollBy({left: 5, top: 0});
|
||||
|
||||
document.getElementById("scroll_2").scrollTo({left: 0, top: 0});
|
||||
document.getElementById("scroll_2").scrollBy({left: 0, top: 5});
|
||||
|
||||
document.getElementById("scroll_3").scrollTo({left: 0, top: 0});
|
||||
document.getElementById("scroll_3").scrollBy({left: 5, top: 5});
|
||||
|
||||
document.getElementById("scroll_4").scrollTo({left: 0, top: 0});
|
||||
document.getElementById("scroll_4").scrollBy({left: 5});
|
||||
document.getElementById("scroll_4").scrollBy({top: 5});
|
||||
|
||||
document.getElementById("scroll_5").scrollTo({left: 0, top: 0});
|
||||
document.getElementById("scroll_5").scrollBy({left: 5, top: 5, behavior: "smooth"});
|
||||
// Expected to interrupt smooth scrolling
|
||||
document.getElementById("scroll_5").scrollBy({});
|
||||
|
||||
document.getElementById("scroll_6").scrollTo({left: 0, top: 0});
|
||||
document.getElementById("scroll_6").scrollBy({left: 5, behavior: "smooth"});
|
||||
// Expected to interrupt smooth scrolling and use the current position
|
||||
// As the default for the axis that are not specified in the target
|
||||
document.getElementById("scroll_6").scrollBy({top: 5, behavior: "smooth"});
|
||||
|
||||
document.getElementById("scroll_7").scrollTo(0, 0);
|
||||
document.getElementById("scroll_7").scrollBy(5, 0);
|
||||
|
||||
document.getElementById("scroll_8").scrollTo(0, 0);
|
||||
document.getElementById("scroll_8").scrollBy(0, 5);
|
||||
|
||||
document.getElementById("scroll_9").scrollTo(0, 0);
|
||||
document.getElementById("scroll_9").scrollBy(5, 5);
|
||||
|
||||
document.getElementById("scroll_10").scrollTo(0, 0);
|
||||
document.getElementById("scroll_10").scrollBy({left: 5, top: 5, behavior: "smooth"});
|
||||
// Expected to interrupt smooth scrolling
|
||||
document.getElementById("scroll_10").scrollBy(0, 0);
|
||||
}
|
||||
|
||||
// Allow smooth scrolling to complete before testing result
|
||||
setTimeout(function() {
|
||||
document.documentElement.removeAttribute("class");
|
||||
}, 500);
|
||||
}
|
||||
|
||||
window.addEventListener("MozReftestInvalidate", doTest, false);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
55
layout/reftests/scrolling/scroll-behavior-7.html
Normal file
55
layout/reftests/scrolling/scroll-behavior-7.html
Normal file
@ -0,0 +1,55 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Testcase for bug 1010538, smooth scrolling expected</title>
|
||||
<style type="text/css">
|
||||
|
||||
html,body {
|
||||
color: black;
|
||||
background-color: white;
|
||||
font-size: 16px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
#a_box {
|
||||
position: relative;
|
||||
left: 10px;
|
||||
top: 10px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background: blue;
|
||||
}
|
||||
|
||||
#another_box {
|
||||
position: relative;
|
||||
left: 2000px;
|
||||
top: 2000px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background: green;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="a_box"></div>
|
||||
<div id="another_box"></div>
|
||||
<script>
|
||||
function doTest() {
|
||||
if (document.location.search != '?ref') {
|
||||
window.scrollTo(500, 500);
|
||||
window.scrollTo(window.scrollX, window.scrollY);
|
||||
}
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
window.scrollTo({left: 0, top: 0, behavior: "instant"});
|
||||
window.addEventListener("MozReftestInvalidate", doTest, false);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user