| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../../resources/js-test.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
| 3 <style> | 4 <style> |
| 4 .target { | 5 .target { |
| 5 position: fixed; | 6 position: fixed; |
| 6 top: 100px; | 7 top: 100px; |
| 7 left: 100px; | 8 left: 100px; |
| 8 width: 100px; | 9 width: 100px; |
| 9 height: 50px; | 10 height: 50px; |
| 10 background-color: #ccc; | 11 background-color: #ccc; |
| 11 } | 12 } |
| 12 </style> | 13 </style> |
| 13 <div style="height: 1000px"></div> | 14 <div style="height: 1000px"></div> |
| 14 <div class="target" id="t1"></div> | 15 <div class="target" id="t1"></div> |
| 15 <div style="position: absolute; top: 100px; transform: translateZ(0)"> | 16 <div style="position: absolute; top: 100px; transform: translateZ(0)"> |
| 16 <div class="target" id="t2"></div> | 17 <div class="target" id="t2"></div> |
| 17 </div> | 18 </div> |
| 18 <script> | 19 <script> |
| 20 test(function(t) { |
| 21 location.hash = "#t1"; |
| 22 assert_equals(window.scrollY, 0); |
| 23 |
| 24 location.hash = "#t2"; |
| 25 assert_equals(window.scrollY, 200); |
| 26 |
| 27 location.hash = "#t1"; |
| 28 assert_equals(window.scrollY, 200); |
| 29 |
| 30 location.hash = "#"; |
| 31 assert_equals(window.scrollY, 0); |
| 32 }, 'Tests that scrolling to a fixed position element does not scroll the viewpor
t.'); |
| 19 </script> | 33 </script> |
| 20 | |
| 21 <script> | |
| 22 | |
| 23 description("Tests that scrolling to a fixed position element does not scroll th
e viewport."); | |
| 24 | |
| 25 location.hash = "#t1"; | |
| 26 shouldBe("scrollY", "0"); | |
| 27 | |
| 28 location.hash = "#t2"; | |
| 29 shouldBe("scrollY", "200"); | |
| 30 | |
| 31 location.hash = "#t1"; | |
| 32 shouldBe("scrollY", "200"); | |
| 33 | |
| 34 location.hash = "#"; | |
| 35 shouldBe("scrollY", "0"); | |
| 36 | |
| 37 </script> | |
| 38 </body> | |
| 39 <html> | |
| OLD | NEW |