| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <style> | 4 <style> |
| 5 body { | 5 body { |
| 6 font-size: 10px; | 6 font-size: 10px; |
| 7 } | 7 } |
| 8 #container { | 8 #container { |
| 9 offset-anchor: 30% 40%; | 9 offset-anchor: 30% 40%; |
| 10 } | 10 } |
| 11 #child1 { | 11 #child1 { |
| 12 offset-anchor: inherit; | 12 offset-anchor: inherit; |
| 13 } | 13 } |
| 14 </style> | 14 </style> |
| 15 <div id="container"> | 15 <div id="container"> |
| 16 <div id="child1"></div> | 16 <div id="child1"></div> |
| 17 <div id="child2"></div> | 17 <div id="child2"></div> |
| 18 </div> | 18 </div> |
| 19 <script> | 19 <script> |
| 20 "use strict"; | 20 "use strict"; |
| 21 | 21 |
| 22 test(function() { | 22 test(function() { |
| 23 var element = document.createElement('div'); | 23 var element = document.createElement('div'); |
| 24 document.body.appendChild(element); | 24 document.body.appendChild(element); |
| 25 assert_equals(getComputedStyle(element, null).offsetAnchor, '50% 50%'); | 25 assert_equals(getComputedStyle(element, null).offsetAnchor, 'auto'); |
| 26 }, 'offset-anchor default is 50% 50%'); | 26 }, 'offset-anchor default is auto'); |
| 27 | 27 |
| 28 test(function() { | 28 test(function() { |
| 29 assert_equals(getComputedStyle(container, null).offsetAnchor, '30% 40%'); | 29 assert_equals(getComputedStyle(container, null).offsetAnchor, '30% 40%'); |
| 30 }, 'offset-anchor can be two percentages'); | 30 }, 'offset-anchor can be two percentages'); |
| 31 | 31 |
| 32 test(function() { | 32 test(function() { |
| 33 assert_equals(getComputedStyle(child1, null).offsetAnchor, '30% 40%'); | 33 assert_equals(getComputedStyle(child1, null).offsetAnchor, '30% 40%'); |
| 34 }, 'offset-anchor can explicitly inherited'); | 34 }, 'offset-anchor can explicitly inherited'); |
| 35 | 35 |
| 36 test(function() { | 36 test(function() { |
| 37 assert_equals(getComputedStyle(child2, null).offsetAnchor, '50% 50%'); | 37 assert_equals(getComputedStyle(child2, null).offsetAnchor, 'auto'); |
| 38 }, 'offset-anchor is not inherited by default'); | 38 }, 'offset-anchor is not inherited by default'); |
| 39 | 39 |
| 40 function computed(specified) { | 40 function computed(specified) { |
| 41 var element = document.createElement('div'); | 41 var element = document.createElement('div'); |
| 42 element.style['offset-anchor'] = specified; | 42 element.style['offset-anchor'] = specified; |
| 43 document.body.appendChild(element); | 43 document.body.appendChild(element); |
| 44 return getComputedStyle(element, null).offsetAnchor; | 44 return getComputedStyle(element, null).offsetAnchor; |
| 45 } | 45 } |
| 46 | 46 |
| 47 test(function() { | 47 test(function() { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 65 }, 'offset-anchor can be supplied with a single keyword'); | 65 }, 'offset-anchor can be supplied with a single keyword'); |
| 66 | 66 |
| 67 test(function() { | 67 test(function() { |
| 68 assert_equals(computed('center'), '50% 50%'); | 68 assert_equals(computed('center'), '50% 50%'); |
| 69 }, 'offset-anchor can be supplied with center'); | 69 }, 'offset-anchor can be supplied with center'); |
| 70 | 70 |
| 71 test(function() { | 71 test(function() { |
| 72 assert_equals(computed('5em 6em'), '50px 60px'); | 72 assert_equals(computed('5em 6em'), '50px 60px'); |
| 73 }, 'offset-anchor can be supplied with em'); | 73 }, 'offset-anchor can be supplied with em'); |
| 74 </script> | 74 </script> |
| OLD | NEW |