scrollTop-display-change.html (594B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>Setting scrollTop to 0 immediately after toggling display from "none" on an element that had nonzero scrollTop before should work.</title> 4 <link rel=match href="scrollTop-display-change-ref.html"> 5 <div id="scroller" style="height: 100px; overflow: scroll"> 6 <div style="height: 1000px"> 7 I should be visible. 8 </div> 9 I should not be visible. 10 </div> 11 <script> 12 scroller.scrollTop = 1000; 13 scroller.style.display = "none"; 14 var win = scroller.scrollTop; // Force layout flush 15 scroller.style.display = ""; 16 scroller.scrollTop = 0; 17 </script>