Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: LayoutTests/fast/css/important-js-override.html

Issue 1094003002: CSSStyleDeclaration::setProperty should override important style (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review feedback Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/css/important-js-override-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/css/important-js-override-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698