OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <script> | 3 <script> |
4 if (window.layoutTestController) | 4 if (window.layoutTestController) |
5 layoutTestController.dumpAsText(); | 5 layoutTestController.dumpAsText(); |
6 | 6 |
7 function log(message) | 7 function log(message) |
8 { | 8 { |
9 document.getElementById("console").appendChild(document.createTextNode(
message + "\n")); | 9 document.getElementById("console").appendChild(document.createTextNode(
message + "\n")); |
10 } | 10 } |
11 </script> | 11 </script> |
12 <body> | 12 <body> |
13 <p>In this test, we set a new scrollTop for a scrolling div, and then we mak
e the div display:none. The test ensures that when we bring the div back by givi
ng it a display value of block, that we also restore its scroll position. The te
st also ensures that we are able to set a new scrollTop value of 0 after that.</
p> | 13 <p>In this test, we set a new scrollTop for a scrolling div, and then we mak
e the div display:none. The test ensures that when we bring the div back by givi
ng it a display value of block, that we also restore its scroll position. The te
st also ensures that we are able to set a new scrollTop value of 0 after that.</
p> |
14 <div id="scroller" style="height: 20px; overflow: scroll;"> | 14 <div id="scroller" style="height: 20px; overflow: scroll;"> |
15 <div style="height: 60px;"></div> | 15 <div style="height: 60px;"></div> |
16 </div> | 16 </div> |
17 <pre id="console"></pre> | 17 <pre id="console"></pre> |
18 <script> | 18 <script> |
19 a = document.getElementById('scroller'); | 19 a = document.getElementById('scroller'); |
20 a.scrollTop = 20; | 20 a.scrollTop = 20; |
21 a.style.display = 'none'; | 21 a.style.display = 'none'; |
22 a.scrollTop = 20; | 22 a.scrollTop = 20; |
23 a.style.display = 'block'; | 23 a.style.display = 'block'; |
24 log('scrollTop after restoring div: ' + a.scrollTop + '\n'); | 24 log('scrollTop after restoring div: ' + a.scrollTop + '\n'); |
25 a.scrollTop = 0; | 25 a.scrollTop = 0; |
26 log('scrollTop after setting scrollTop back to 0: ' + a.scrollTop + '\n'); | 26 log('scrollTop after setting scrollTop back to 0: ' + a.scrollTop + '\n'); |
27 </script> | 27 </script> |
28 </body> | 28 </body> |
29 </html> | 29 </html> |
OLD | NEW |