abspos-contributes-to-static-parent-bounds.html (975B)
1 <!DOCTYPE html> 2 <meta name="viewport" content="width=device-width,initial-scale=1"> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <style> 6 7 body, html, #static { height: 0; } 8 #abs { 9 position: absolute; 10 left: 50px; 11 top: 50px; 12 height: 1200px; 13 padding: 50px; 14 border: 5px solid gray; 15 } 16 #anchor { 17 background-color: #afa; 18 width: 100px; 19 height: 100px; 20 } 21 22 </style> 23 <div id="static"> 24 <div id="abs"> 25 <div id="changer"></div> 26 <div id="anchor"></div> 27 </div> 28 </div> 29 <script> 30 31 // Tests that the "bounds" of an element, for the purpose of visibility in the 32 // anchor node selection algorithm, include any space occupied by the element's 33 // positioned descendants. 34 35 test(() => { 36 document.scrollingElement.scrollTop = 120; 37 document.querySelector("#changer").style.height = "100px"; 38 assert_equals(document.scrollingElement.scrollTop, 220); 39 }, "Abs-pos with zero-height static parent."); 40 41 </script>