| 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 #anchor { | |
| 6 display: none; | |
| 7 position: absolute; | |
| 8 width: 60px; | |
| 9 height: 30px; | |
| 10 background-color: #eee; | |
| 11 font: bold 10pt monospace; | |
| 12 padding: 10px; | |
| 13 left: 50vw; | |
| 14 top: 200vh; | |
| 15 } | |
| 16 | |
| 17 </style> | |
| 18 <a id="anchor" name="foo">ANCHOR</a> | |
| 19 <script> | |
| 20 | |
| 21 description("Tests that the scroll position does not stick to the anchor if " + | |
| 22 "it becomes visible after the page has finished loading."); | |
| 23 | |
| 24 var jsTestIsAsync = true; | |
| 25 var anchor = document.querySelector("#anchor"); | |
| 26 | |
| 27 onhashchange = function() { | |
| 28 if (location.hash != '#foo') | |
| 29 return; | |
| 30 | |
| 31 anchor.style.display = 'block'; | |
| 32 runAfterLayoutAndPaint(function() { | |
| 33 shouldBe("scrollY", "0"); | |
| 34 | |
| 35 location.hash = "#"; | |
| 36 anchor.style.display = 'none'; | |
| 37 finishJSTest(); | |
| 38 }); | |
| 39 }; | |
| 40 | |
| 41 onload = function() { | |
| 42 runAfterLayoutAndPaint(function() { | |
| 43 location.hash = "#foo"; | |
| 44 }); | |
| 45 }; | |
| 46 | |
| 47 </script> | |
| OLD | NEW |