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-position: auto; |
| 9 } |
| 10 #div3 { |
| 11 offset-position: 10px 20px; |
| 12 } |
| 13 #div4 { |
| 14 offset-position: 30px top; |
| 15 } |
| 16 #div5 { |
| 17 offset-position: left 40px; |
| 18 } |
| 19 #div6 { |
| 20 offset-position: center; |
| 21 } |
| 22 #div7 { |
| 23 offset-position: 5em 6em; |
| 24 font: 10px Ahem; |
| 25 } |
| 26 #div8 { |
| 27 offset-position: 30% 40%; |
| 28 } |
| 29 #div9 { |
| 30 offset-position: 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-position: right bottom"></span> |
| 47 |
| 48 <script> |
| 49 "use strict"; |
| 50 |
| 51 test(function() { |
| 52 assert_equals(getComputedStyle(div1, null).offsetPosition, 'auto'); |
| 53 }, 'offset-position default is auto'); |
| 54 |
| 55 test(function() { |
| 56 assert_equals(getComputedStyle(div2, null).offsetPosition, 'auto'); |
| 57 }, 'offset-position auto remains auto'); |
| 58 |
| 59 test(function() { |
| 60 assert_equals(getComputedStyle(div3, null).offsetPosition, '10px 20px'); |
| 61 }, 'offset-position can be fixed lengths'); |
| 62 |
| 63 test(function() { |
| 64 assert_equals(getComputedStyle(div4, null).offsetPosition, '30px 0%'); |
| 65 }, 'offset-position can be a length and a keyword'); |
| 66 |
| 67 test(function() { |
| 68 assert_equals(getComputedStyle(div5, null).offsetPosition, '0% 40px'); |
| 69 }, 'offset-position can be a keyword and a length'); |
| 70 |
| 71 test(function() { |
| 72 assert_equals(getComputedStyle(div6, null).offsetPosition, '50% 50%'); |
| 73 }, 'offset-position can be supplied with a single keyword'); |
| 74 |
| 75 test(function() { |
| 76 assert_equals(getComputedStyle(div7, null).offsetPosition, '50px 60px'); |
| 77 }, 'offset-position can be supplied with em'); |
| 78 |
| 79 test(function() { |
| 80 assert_equals(getComputedStyle(div8, null).offsetPosition, '30% 40%'); |
| 81 }, 'offset-position is unaffected by child elements'); |
| 82 |
| 83 test(function() { |
| 84 assert_equals(getComputedStyle(div9, null).offsetPosition, '30% 40%'); |
| 85 }, 'offset-position can be explicitly inherited'); |
| 86 |
| 87 test(function() { |
| 88 assert_equals(getComputedStyle(div10, null).offsetPosition, 'auto'); |
| 89 }, 'offset-position is not inherited by default'); |
| 90 |
| 91 test(function() { |
| 92 assert_equals(span1.style.offsetPosition, 'right bottom'); |
| 93 }, 'offset-position style can be set inline'); |
| 94 |
| 95 </script> |
| 96 </body> |
| 97 </html> |
OLD | NEW |