scroll-behavior-10.html 1.5 KB

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