containing-block-change-scrollframe.html (1330B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>Tests that after making a scrolling box a containing block, dynamically-inserted abspos boxes still get positioned correctly</title> 4 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1735533"> 5 <link rel="help" href="https://drafts.csswg.org/css-position/#abspos-insets"> 6 <link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez"> 7 <link rel="author" href="https://mozilla.org" title="Mozilla"> 8 <link rel="match" href="containing-block-change-scrollframe-ref.html"> 9 <style> 10 #container { 11 width: 400px; 12 height: 400px; 13 margin: 100px; 14 background-color: purple; 15 overflow: hidden; 16 } 17 #spacer { 18 height: 700px; 19 } 20 #bottom { 21 height: 100px; 22 background-color: green; 23 } 24 #abspos { 25 position: absolute; 26 width: 100px; 27 height: 100px; 28 background-color: green; 29 top: 400px; 30 left: 0; 31 } 32 </style> 33 <div id="container"> 34 <div id="spacer"></div> 35 <div id="bottom"></div> 36 </div> 37 <script> 38 let container = document.getElementById("container"); 39 container.scrollTop = 400; 40 container.getBoundingClientRect(); 41 container.style.position = "relative"; 42 container.getBoundingClientRect(); 43 let abspos = document.createElement("div"); 44 abspos.id = "abspos"; 45 container.appendChild(abspos); 46 </script>