basic.html (615B)
1 <!DOCTYPE html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <style> 5 6 body { height: 4000px; } 7 div { height: 100px; } 8 9 </style> 10 <div id="block1">abc</div> 11 <div id="block2">def</div> 12 <script> 13 14 // Tests that growing an element above the viewport produces a scroll 15 // anchoring adjustment equal to the amount by which it grew. 16 17 test(() => { 18 document.scrollingElement.scrollTop = 150; 19 document.querySelector("#block1").style.height = "200px"; 20 assert_equals(document.scrollingElement.scrollTop, 250); 21 }, "Minimal scroll anchoring example."); 22 23 </script>