| <!DOCTYPE html> |
| <html> |
| <script> |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| function log(message) |
| { |
| document.getElementById("console").appendChild(document.createTextNode(message + "\n")); |
| } |
| </script> |
| <body> |
| <p>In this test, we set a new scrollTop for a scrolling div, and then we make the div display:none. The test ensures that when we bring the div back by giving it a display value of block, that we also restore its scroll position. The test also ensures that we are able to set a new scrollTop value of 0 after that.</p> |
| <div id="scroller" style="height: 20px; overflow: scroll;"> |
| <div style="height: 60px;"></div> |
| </div> |
| <pre id="console"></pre> |
| <script> |
| a = document.getElementById('scroller'); |
| a.scrollTop = 20; |
| a.style.display = 'none'; |
| a.scrollTop = 20; |
| a.style.display = 'block'; |
| log('scrollTop after restoring div: ' + a.scrollTop + '\n'); |
| a.scrollTop = 0; |
| log('scrollTop after setting scrollTop back to 0: ' + a.scrollTop + '\n'); |
| </script> |
| </body> |
| </html> |