| <!DOCTYPE html> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <style> |
| .target { |
| position: fixed; |
| top: 100px; |
| left: 100px; |
| width: 100px; |
| height: 50px; |
| background-color: #ccc; |
| } |
| </style> |
| <div style="height: 1000px"></div> |
| <div class="target" id="t1"></div> |
| <div style="position: absolute; top: 100px; transform: translateZ(0)"> |
| <div class="target" id="t2"></div> |
| </div> |
| <script> |
| test(function(t) { |
| location.hash = "#t1"; |
| assert_equals(window.scrollY, 0); |
| |
| location.hash = "#t2"; |
| assert_equals(window.scrollY, 200); |
| |
| location.hash = "#t1"; |
| assert_equals(window.scrollY, 200); |
| |
| location.hash = "#"; |
| assert_equals(window.scrollY, 0); |
| }, 'Tests that scrolling to a fixed position element does not scroll the viewport.'); |
| </script> |