scroll-behavior-1.html (1282B)
1 <!DOCTYPE HTML> 2 <html class="reftest-wait"> 3 <head> 4 <meta charset="utf-8"> 5 <title>Testcase for bug 1010538, smooth scrolling expected</title> 6 <style type="text/css"> 7 8 html,body { 9 color: black; 10 background-color: white; 11 font-size: 16px; 12 padding: 0; 13 margin: 0; 14 } 15 16 html { 17 scroll-behavior: smooth; 18 } 19 20 #a_box { 21 position: relative; 22 left: 10px; 23 top: 10px; 24 width: 20px; 25 height: 20px; 26 background: blue; 27 } 28 29 #another_box { 30 position: relative; 31 left: 2000px; 32 top: 2000px; 33 width: 20px; 34 height: 20px; 35 background: green; 36 } 37 38 </style> 39 </head> 40 <body> 41 <div id="a_box"></div> 42 <div id="another_box"></div> 43 <script> 44 function doTest() { 45 if (document.location.search != '?ref') { 46 window.scrollTo({left: 500, top: 500}); 47 window.scrollTo({left: window.scrollX, top: window.scrollY}); 48 } 49 document.documentElement.removeAttribute("class"); 50 } 51 window.scrollTo({left: 0, top: 0, behavior: "instant"}); 52 window.addEventListener("MozReftestInvalidate", doTest); 53 </script> 54 </body> 55 </html>