| 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 --a: red; | 6 --a: red; |
| 7 --b: blue; | 7 --b: blue; |
| 8 } | 8 } |
| 9 | 9 |
| 10 .foo { | 10 .setAToGreen { |
| 11 --a: green; | 11 --a: green; |
| 12 } | 12 } |
| 13 | 13 |
| 14 .container { | 14 .setAToB { |
| 15 --a: var(--b); | 15 --a: var(--b); |
| 16 } | 16 } |
| 17 | 17 |
| 18 .here { | 18 .backgroundA { |
| 19 background: var(--a); | 19 background: var(--a); |
| 20 width: 100px; | 20 } |
| 21 height: 100px; | |
| 22 } | |
| 23 </style> | 21 </style> |
| 24 <div id="outer"> | 22 <div id="outer"> |
| 25 <div class="here" id='red'></div> | 23 <div class="backgroundA" id='backgroundA'></div> |
| 26 | 24 |
| 27 <div class="container" id='container'> | 25 <div class="setAToB"> |
| 28 <div class="here" id='blue'></div> | 26 <div class="backgroundA" id='backgroundB'></div> |
| 29 </div> | 27 </div> |
| 30 </div> | 28 </div> |
| 31 | 29 |
| 32 <script> | 30 <script> |
| 33 test(function() { | 31 test(function() { |
| 34 assert_equals(getComputedStyle(red).backgroundColor, "rgb(255, 0, 0)"); | 32 var red = "rgb(255, 0, 0)"; |
| 35 assert_equals(getComputedStyle(blue).backgroundColor, "rgb(0, 0, 255)"); | 33 var blue = "rgb(0, 0, 255)"; |
| 36 outer.classList.add('foo'); | 34 var green = "rgb(0, 128, 0)"; |
| 37 assert_equals(getComputedStyle(red).backgroundColor, "rgb(0, 128, 0)"); | 35 assert_equals(getComputedStyle(backgroundA).backgroundColor, red); |
| 38 assert_equals(getComputedStyle(blue).backgroundColor, "rgb(0, 0, 255)"); | 36 assert_equals(getComputedStyle(backgroundB).backgroundColor, blue); |
| 37 outer.classList.add('setAToGreen'); |
| 38 assert_equals(getComputedStyle(backgroundA).backgroundColor, green); |
| 39 assert_equals(getComputedStyle(backgroundB).backgroundColor, blue); |
| 39 }, 'Custom properties are recomputed when parent style changes.'); | 40 }, 'Custom properties are recomputed when parent style changes.'); |
| 40 </script> | 41 </script> |
| OLD | NEW |