| OLD | NEW |
| 1 <div id="a" style="background-color: green !important">The background of this el
ement should be green. It is </div> | 1 <!DOCTYPE html> |
| 2 <div id="element"></div> |
| 3 |
| 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> |
| 2 <script> | 6 <script> |
| 3 if (window.testRunner) | 7 test(function () { |
| 4 testRunner.dumpAsText(); | 8 element.style.cssText = ''; |
| 5 var a = document.getElementById("a"); | 9 |
| 6 a.style.backgroundColor = "red"; | 10 element.style.setProperty('color', 'red'); |
| 7 a.innerHTML += a.style.backgroundColor; | 11 assert_equals(element.style.getPropertyValue('color'), 'red'); |
| 12 assert_equals(element.style.getPropertyPriority('color'), ''); |
| 13 |
| 14 element.style.setProperty('color', 'green'); |
| 15 assert_equals(element.style.getPropertyValue('color'), 'green'); |
| 16 assert_equals(element.style.getPropertyPriority('color'), ''); |
| 17 }, "Check that a non-important inline style can be replaced by a non-important o
ne with setProperty()"); |
| 18 |
| 19 test(function () { |
| 20 element.style.cssText = ''; |
| 21 |
| 22 element.style.color = 'red'; |
| 23 assert_equals(element.style.getPropertyValue('color'), 'red'); |
| 24 assert_equals(element.style.getPropertyPriority('color'), ''); |
| 25 |
| 26 element.style.color = 'green'; |
| 27 assert_equals(element.style.getPropertyValue('color'), 'green'); |
| 28 assert_equals(element.style.getPropertyPriority('color'), ''); |
| 29 }, "Check that a non-important inline style can be replaced by a non-important o
ne without setProperty()"); |
| 30 |
| 31 test(function () { |
| 32 element.style.cssText = ''; |
| 33 |
| 34 element.style.setProperty('color', 'red'); |
| 35 assert_equals(element.style.getPropertyValue('color'), 'red'); |
| 36 assert_equals(element.style.getPropertyPriority('color'), ''); |
| 37 |
| 38 element.style.setProperty('color', 'green', 'important'); |
| 39 assert_equals(element.style.getPropertyValue('color'), 'green'); |
| 40 assert_equals(element.style.getPropertyPriority('color'), 'important'); |
| 41 }, "Check that a non-important inline style can be replaced by an important one
with setProperty()"); |
| 42 |
| 43 test(function () { |
| 44 element.style.cssText = ''; |
| 45 |
| 46 element.style.setProperty('color', 'red', 'important'); |
| 47 assert_equals(element.style.getPropertyValue('color'), 'red'); |
| 48 assert_equals(element.style.getPropertyPriority('color'), 'important'); |
| 49 |
| 50 element.style.setProperty('color', 'green'); |
| 51 assert_equals(element.style.getPropertyValue('color'), 'green'); |
| 52 assert_equals(element.style.getPropertyPriority('color'), ''); |
| 53 }, "Check that a important inline style can be replaced by a non-important one w
ith setProperty()"); |
| 54 |
| 55 test(function () { |
| 56 element.style.cssText = ''; |
| 57 |
| 58 element.style.setProperty('color', 'red', 'important'); |
| 59 assert_equals(element.style.getPropertyValue('color'), 'red'); |
| 60 assert_equals(element.style.getPropertyPriority('color'), 'important'); |
| 61 |
| 62 element.style.color = 'green'; |
| 63 assert_equals(element.style.getPropertyValue('color'), 'green'); |
| 64 assert_equals(element.style.getPropertyPriority('color'), ''); |
| 65 }, "Check that a important inline style can be replaced by a non-important one w
ithout setProperty()"); |
| 66 |
| 67 test(function () { |
| 68 element.style.cssText = ''; |
| 69 |
| 70 element.style.setProperty('color', 'red', 'important'); |
| 71 assert_equals(element.style.getPropertyValue('color'), 'red'); |
| 72 assert_equals(element.style.getPropertyPriority('color'), 'important'); |
| 73 |
| 74 element.style.setProperty('color', 'green', 'important'); |
| 75 assert_equals(element.style.getPropertyValue('color'), 'green'); |
| 76 assert_equals(element.style.getPropertyPriority('color'), 'important'); |
| 77 }, "Check that an important inline style can be replaced by an important one wit
h setProperty()"); |
| 8 </script> | 78 </script> |
| OLD | NEW |