OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> |
| 6 <style> |
| 7 #div2 { |
| 8 offset-anchor: auto; |
| 9 } |
| 10 #div3 { |
| 11 offset-anchor: 10px 20px; |
| 12 } |
| 13 #div4 { |
| 14 offset-anchor: 30px top; |
| 15 } |
| 16 #div5 { |
| 17 offset-anchor: left 40px; |
| 18 } |
| 19 #div6 { |
| 20 offset-anchor: center; |
| 21 } |
| 22 #div7 { |
| 23 offset-anchor: 5em 6em; |
| 24 font: 10px Ahem; |
| 25 } |
| 26 #div8 { |
| 27 offset-anchor: 30% 40%; |
| 28 } |
| 29 #div9 { |
| 30 offset-anchor: inherit; |
| 31 } |
| 32 </style> |
| 33 </head> |
| 34 <body> |
| 35 <div id="div1"></div> |
| 36 <div id="div2"></div> |
| 37 <div id="div3"></div> |
| 38 <div id="div4"></div> |
| 39 <div id="div5"></div> |
| 40 <div id="div6"></div> |
| 41 <div id="div7"></div> |
| 42 <div id="div8"> |
| 43 <div id="div9"></div> |
| 44 <div id="div10"></div> |
| 45 </div> |
| 46 <span id="span1" style="offset-anchor: right bottom"></span> |
| 47 |
| 48 <script> |
| 49 "use strict"; |
| 50 |
| 51 test(function() { |
| 52 assert_equals(getComputedStyle(div1, null).offsetAnchor, 'auto'); |
| 53 }, 'offset-anchor default is auto'); |
| 54 |
| 55 test(function() { |
| 56 assert_equals(getComputedStyle(div2, null).offsetAnchor, 'auto'); |
| 57 }, 'offset-anchor auto remains auto'); |
| 58 |
| 59 test(function() { |
| 60 assert_equals(getComputedStyle(div3, null).offsetAnchor, '10px 20px'); |
| 61 }, 'offset-anchor can be fixed lengths'); |
| 62 |
| 63 test(function() { |
| 64 assert_equals(getComputedStyle(div4, null).offsetAnchor, '30px 0%'); |
| 65 }, 'offset-anchor can be a length and a keyword'); |
| 66 |
| 67 test(function() { |
| 68 assert_equals(getComputedStyle(div5, null).offsetAnchor, '0% 40px'); |
| 69 }, 'offset-anchor can be a keyword and a length'); |
| 70 |
| 71 test(function() { |
| 72 assert_equals(getComputedStyle(div6, null).offsetAnchor, '50% 50%'); |
| 73 }, 'offset-anchor can be supplied with a single keyword'); |
| 74 |
| 75 test(function() { |
| 76 assert_equals(getComputedStyle(div7, null).offsetAnchor, '50px 60px'); |
| 77 }, 'offset-anchor can be supplied with em'); |
| 78 |
| 79 test(function() { |
| 80 assert_equals(getComputedStyle(div8, null).offsetAnchor, '30% 40%'); |
| 81 }, 'offset-anchor is unaffected by child elements'); |
| 82 |
| 83 test(function() { |
| 84 assert_equals(getComputedStyle(div9, null).offsetAnchor, '30% 40%'); |
| 85 }, 'offset-anchor can be explicitly inherited'); |
| 86 |
| 87 test(function() { |
| 88 assert_equals(getComputedStyle(div10, null).offsetAnchor, 'auto'); |
| 89 }, 'offset-anchor is not inherited by default'); |
| 90 |
| 91 test(function() { |
| 92 assert_equals(span1.style.offsetAnchor, 'right bottom'); |
| 93 }, 'offset-anchor style can be set inline'); |
| 94 |
| 95 </script> |
| 96 </body> |
| 97 </html> |
OLD | NEW |