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

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: Renamed addParsedProperty to addRespectingCascade 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
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>
Timothy Loh 2015/04/24 09:21:27 Should have a test for "element.style.color = gree
sashab 2015/04/26 23:23:41 Done, added 2 more tests.
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");
18
19 test(function () {
20 element.style.cssText = '';
21
22 element.style.setProperty('color', 'red');
23 assert_equals(element.style.getPropertyValue('color'), 'red');
24 assert_equals(element.style.getPropertyPriority('color'), '');
25
26 element.style.setProperty('color', 'green', 'important');
27 assert_equals(element.style.getPropertyValue('color'), 'green');
28 assert_equals(element.style.getPropertyPriority('color'), 'important');
29 }, "Check that a non-important inline style can be replaced by a important one") ;
30
31 test(function () {
32 element.style.cssText = '';
33
34 element.style.setProperty('color', 'red', 'important');
35 assert_equals(element.style.getPropertyValue('color'), 'red');
36 assert_equals(element.style.getPropertyPriority('color'), 'important');
37
38 element.style.setProperty('color', 'green');
39 assert_equals(element.style.getPropertyValue('color'), 'green');
40 assert_equals(element.style.getPropertyPriority('color'), '');
41 }, "Check that a important inline style can be replaced by a non-important one") ;
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', 'important');
51 assert_equals(element.style.getPropertyValue('color'), 'green');
52 assert_equals(element.style.getPropertyPriority('color'), 'important');
53 }, "Check that an important inline style can be replaced by a important one");
8 </script> 54 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/css/important-js-override-expected.txt » ('j') | Source/core/css/StylePropertySet.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698