anonymous-block-box.html (1005B)
1 <!DOCTYPE html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <style> 5 6 body { height: 2000px; margin: 0 10px; } 7 #before, #after { height: 100px; } 8 #before { margin-bottom: 100px; } 9 #container { line-height: 100px; vertical-align: top; } 10 11 </style> 12 <div id="container"> 13 <div id="before">before</div> 14 <span id="inline">inline</span> 15 <div id="after">after</div> 16 </div> 17 <script> 18 19 // Tests anchoring inside an anonymous block box. The anchor selection algorithm 20 // should descend into the children of the anonymous box even though it is fully 21 // contained in the viewport. 22 23 test(() => { 24 document.scrollingElement.scrollTop = 150; 25 26 var span = document.querySelector("#inline"); 27 var newSpan = document.createElement("span"); 28 newSpan.innerHTML = "inserted<br>"; 29 span.parentNode.insertBefore(newSpan, span); 30 31 assert_equals(document.scrollingElement.scrollTop, 250); 32 }, "Anchor selection descent into anonymous block boxes."); 33 34 </script>