| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <script src="../../resources/js-test.js"></script> | |
| 3 <script src="../../resources/run-after-layout-and-paint.js"></script> | |
| 4 <style> | |
| 5 | |
| 6 #anchor { | |
| 7 display: block; | |
| 8 position: absolute; | |
| 9 width: 60px; | |
| 10 height: 30px; | |
| 11 background-color: #eee; | |
| 12 font: bold 10pt monospace; | |
| 13 padding: 10px; | |
| 14 left: 200px; | |
| 15 top: 150px; | |
| 16 } | |
| 17 | |
| 18 </style> | |
| 19 <a id="anchor" name="foo">ANCHOR</a> | |
| 20 <script> | |
| 21 | |
| 22 description("Tests that the scroll position does not stick to the anchor if " + | |
| 23 "it moves after the page has finished loading."); | |
| 24 | |
| 25 var jsTestIsAsync = true; | |
| 26 var anchor = document.querySelector("#anchor"); | |
| 27 | |
| 28 onload = function() { | |
| 29 runAfterLayoutAndPaint(function() { | |
| 30 location.hash = "#foo"; | |
| 31 | |
| 32 runAfterLayoutAndPaint(function() { | |
| 33 anchor.style.top = "1000px"; | |
| 34 | |
| 35 shouldBe("scrollY", "0"); | |
| 36 | |
| 37 location.hash = "#"; | |
| 38 anchor.style.top = ""; | |
| 39 finishJSTest(); | |
| 40 }); | |
| 41 }); | |
| 42 }; | |
| 43 | |
| 44 </script> | |
| OLD | NEW |