| <!DOCTYPE html> |
| <script src="../../resources/js-test.js"></script> |
| <script src="../../resources/run-after-layout-and-paint.js"></script> |
| <style> |
| #frag { |
| background-color: #faa; |
| display: block; |
| height: 100px; |
| margin-bottom: 500px; |
| position: absolute; |
| top: 1200px; |
| width: 100px; |
| } |
| #box { |
| background-color: #afa; |
| height: 100px; |
| position: absolute; |
| top: 600px; |
| width: 100px; |
| } |
| </style> |
| <p> |
| Tests that after a navigation, scroll restoration from history takes |
| precedence over scrolling to the hash fragment. |
| </p> |
| <div id="console"></div> |
| <div id="box"></div> |
| <a id="frag" name="frag"></a> |
| <script> |
| |
| jsTestIsAsync = true; |
| if (location.hash == "") { |
| runAfterLayoutAndPaint(function() { |
| scrollTo(0, 0); |
| location.hash = 'frag'; |
| scrollTo(0, 600); |
| location.href = "resources/empty-document-goes-back.html"; |
| }); |
| } else { |
| runAfterLayoutAndPaint(function() { |
| shouldBe(String(scrollY), '600'); |
| history.back(); |
| finishJSTest(); |
| }); |
| } |
| |
| </script> |