dynamic-offset-rtl-002.html (1191B)
1 <!DOCTYPE HTML> 2 <head> 3 <meta charset="UTF-8"> 4 <title>CSS Test: dynamic changes to offset properties</title> 5 <link rel="author" title="L. David Baron" href="https://dbaron.org/"> 6 <link rel="author" title="Mozilla" href="https://www.mozilla.org/"> 7 <link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#vertical-layout"> 8 <link rel="match" href="dynamic-offset-rtl-001-ref.html"> 9 <meta name="flags" content="dom"> 10 <meta name="assert" content="Layout rules for 'right' and 'left' are handled correctly for absolutely positioned elements, in the presence of dynamic changes to 'width' of the containing block."> 11 <style> 12 13 html { 14 direction: rtl; 15 overflow: hidden; 16 } 17 18 #container { 19 position: absolute; 20 top: 0; 21 left: 0; 22 width: 200px; 23 height: 100px; 24 background: yellow; 25 } 26 27 #abspos { 28 position: absolute; 29 top: 10px; 30 right: 20px; 31 left: 10px; /* ignored */ 32 width: 10px; 33 height: 10px; 34 background: fuchsia; 35 } 36 37 </style> 38 39 <div id="container"> 40 <div id="abspos"></div> 41 </div> 42 43 <script> 44 45 window.addEventListener("load", function(event) { 46 var e = document.getElementById("abspos"); 47 e.offsetTop; // flush layout 48 e.parentNode.style.width = "100px"; 49 }); 50 51 </script>