OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../js/resources/js-test-pre.js"></script> |
| 5 <script> |
| 6 description('Test ensures that documentElement.scrollTop/Left properties are
available by the time DOMContentLoaded event fires.'); |
| 7 // Navigation steps: |
| 8 // 1- page gets first loaded and scrolled. |
| 9 // 2- reload is performed. |
| 10 // Test: ensure that by the time DOMContenLoaded fires (after a reload navig
ation), documentElement.scrollTop/Left are set. |
| 11 // 3- navigate away and then back again. |
| 12 // Test: ensure that by the time DOMContenLoaded fires (after a back navigat
ion), documentElement.scrollTop/Left are set. |
| 13 |
| 14 function init(evt) { |
| 15 if (window.name == 'second/load') { |
| 16 shouldBe('document.documentElement.scrollTop', '1000'); |
| 17 shouldBe('document.documentElement.scrollLeft', '1000'); |
| 18 |
| 19 window.name = "third/load"; |
| 20 setTimeout('window.location = "data:text/html,<script>history.back()
;</scr" + "ipt>"', 0); |
| 21 } else if (window.name == 'third/load') { |
| 22 // Returned back. |
| 23 window.name = ""; |
| 24 shouldBe('document.documentElement.scrollTop', '1000'); |
| 25 shouldBe('document.documentElement.scrollLeft', '1000'); |
| 26 |
| 27 if (window.testRunner) |
| 28 finishJSTest(); |
| 29 } else { |
| 30 window.scrollTo(1000, 1000); |
| 31 window.name = "second/load"; |
| 32 setTimeout('location.reload()', 0); |
| 33 } |
| 34 } |
| 35 |
| 36 window.addEventListener('DOMContentLoaded', init, true); |
| 37 window.onunload = function() {} // prevent caching |
| 38 |
| 39 var jsTestIsAsync = true; |
| 40 </script> |
| 41 <body> |
| 42 <div style='width: 9999px; height:9999px; float:left;'></div> |
| 43 <h1 id='console'/> |
| 44 </body> |
| 45 <script src="../js/resources/js-test-post.js"></script> |
| 46 </html> |
OLD | NEW |