| OLD | NEW |
| (Empty) | |
| 1 <!doctype html> |
| 2 <script src="../../../resources/testharness.js"></script> |
| 3 <script src="../../../resources/testharnessreport.js"></script> |
| 4 <body> |
| 5 <p>Dynamic absolute positioning inside inline-relative container</p> |
| 6 <div id="LIKEBODY" style="position:relative"> |
| 7 <div id="CONTAIN" style="position:relative; display:inline">CONTAIN |
| 8 <div id="TARGET" style="position:absolute; right:0; top:0; width:20px; hei
ght:20px; background: green">T</div> |
| 9 THE TARGET |
| 10 </div> |
| 11 </div> |
| 12 <script> |
| 13 let contain = document.querySelector('#CONTAIN'); |
| 14 let target = document.querySelector('#TARGET'); |
| 15 let likebody = document.querySelector('#LIKEBODY'); |
| 16 |
| 17 test(() => { |
| 18 let containRect = contain.getClientRects(); |
| 19 let targetRect = target.getClientRects(); |
| 20 assert_equals(containRect[0].right, targetRect[0].right, "#TARGET right alig
ns with #CONTAIN"); |
| 21 assert_equals(containRect[0].top, targetRect[0].top, "#TARGET top aligns wit
h #CONTAIN"); |
| 22 }, "test0: initial #TARGET containing rect is #CONTAIN" |
| 23 ); |
| 24 |
| 25 test(() => { |
| 26 contain.style.position = 'static'; |
| 27 let likebodyRect = likebody.getClientRects(); |
| 28 let targetRect = target.getClientRects(); |
| 29 assert_equals(likebodyRect[0].right, targetRect[0].right, "#TARGET right ali
gns with #LIKEBODY"); |
| 30 assert_equals(likebodyRect[0].top, targetRect[0].top, "#TARGET top aligns wi
th #LIKEBODY"); |
| 31 |
| 32 }, "test1: after relative->static, #TARGET containing rect is #LIKEBODY" |
| 33 ); |
| 34 |
| 35 test(() => { |
| 36 contain.style.position = 'relative'; |
| 37 let containRect = contain.getClientRects(); |
| 38 let targetRect = target.getClientRects(); |
| 39 assert_equals(containRect[0].right, targetRect[0].right, "#TARGET right alig
ns with #CONTAIN"); |
| 40 assert_equals(containRect[0].top, targetRect[0].top, "#TARGET top aligns wit
h #CONTAIN"); |
| 41 }, "test2: after static->relative, #TARGET containing rect is #CONTAIN" |
| 42 ); |
| 43 </script> |
| 44 |
| 45 |
| OLD | NEW |