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 #target { | 5 #target { |
6 background: var(--inherited-color); | 6 background: var(--inherited-color); |
7 color: var(--non-inherited-color); | 7 color: var(--non-inherited-color); |
8 } | 8 } |
9 </style> | 9 </style> |
10 <div id=target></div> | 10 <div id=target></div> |
11 <script> | 11 <script> |
12 CSS.registerProperty({name: '--length', syntax: '<length>', initialValue: 'calc(
10px + 15px)'}); | 12 CSS.registerProperty({name: '--length', syntax: '<length>', initialValue: 'calc(
10px + 15px)'}); |
13 CSS.registerProperty({name: '--length-percentage', syntax: '<length-percentage>'
, initialValue: 'calc(1in + 10% + 4px)'}); | 13 CSS.registerProperty({name: '--length-percentage', syntax: '<length-percentage>'
, initialValue: 'calc(1in + 10% + 4px)'}); |
14 CSS.registerProperty({name: '--inherited-color', syntax: '<color>', initialValue
: 'pink', inherits: true}); | 14 CSS.registerProperty({name: '--inherited-color', syntax: '<color>', initialValue
: 'pink', inherits: true}); |
15 CSS.registerProperty({name: '--non-inherited-color', syntax: '<color>', initialV
alue: 'purple'}); | 15 CSS.registerProperty({name: '--non-inherited-color', syntax: '<color>', initialV
alue: 'purple'}); |
| 16 CSS.registerProperty({name: '--single-transform-list', syntax: '<transform-list>
', initialValue: 'scale(calc(2 + 2))'}); |
| 17 CSS.registerProperty({name: '--multiple-transform-list', syntax: '<transform-lis
t>', initialValue: 'scale(calc(2 + 1)) translateX(calc(3px + 1px))'}); |
16 | 18 |
17 test(function() { | 19 test(function() { |
18 computedStyle = getComputedStyle(target); | 20 computedStyle = getComputedStyle(target); |
19 assert_equals(computedStyle.getPropertyValue('--length'), '25px'); | 21 assert_equals(computedStyle.getPropertyValue('--length'), '25px'); |
20 assert_equals(computedStyle.getPropertyValue('--length-percentage'), 'calc(1
00px + 10%)'); | 22 assert_equals(computedStyle.getPropertyValue('--length-percentage'), 'calc(1
00px + 10%)'); |
21 assert_equals(computedStyle.getPropertyValue('--inherited-color'), 'pink'); | 23 assert_equals(computedStyle.getPropertyValue('--inherited-color'), 'pink'); |
22 assert_equals(computedStyle.getPropertyValue('--non-inherited-color'), 'purp
le'); | 24 assert_equals(computedStyle.getPropertyValue('--non-inherited-color'), 'purp
le'); |
| 25 assert_equals(computedStyle.getPropertyValue('--single-transform-list'), 'sc
ale(4)'); |
| 26 assert_equals(computedStyle.getPropertyValue('--multiple-transform-list'), '
scale(3) translateX(4px)'); |
23 | 27 |
24 assert_equals(computedStyle.backgroundColor, 'rgb(255, 192, 203)'); | 28 assert_equals(computedStyle.backgroundColor, 'rgb(255, 192, 203)'); |
25 assert_equals(computedStyle.color, 'rgb(128, 0, 128)'); | 29 assert_equals(computedStyle.color, 'rgb(128, 0, 128)'); |
26 }, "Initial values of registered properties can be referenced when no custom pro
perties are explicitly set."); | 30 }, "Initial values of registered properties can be referenced when no custom pro
perties are explicitly set."); |
27 </script> | 31 </script> |
OLD | NEW |