serialization-CSSDeclaration-with-important.html (1757B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>cssom - Serialization of CSS declaration with "important" flag</title> 4 <link rel="help" href="https://drafts.csswg.org/cssom/#serialize-a-css-declaration"> 5 <script src=/resources/testharness.js></script> 6 <script src=/resources/testharnessreport.js></script> 7 <div id="noWhitespace" style="display: inline !important;"></div> 8 <div id="whitespace" style="background-color: blue !important; color: red ! important;"></div> 9 <div id="dinamicallyStyle"></div> 10 <script> 11 test(function () { 12 var css_style = document.querySelector('#noWhitespace').style.cssText; 13 assert_equals(css_style, "display: inline !important;"); 14 }, "Inline style declaration without whitespace between '!' and 'important'."); 15 16 test(function () { 17 var css_style = document.querySelector('#whitespace').style.cssText; 18 assert_equals(css_style, "background-color: blue !important; color: red !important;"); 19 }, "Inline style declaration with whitespace between '!' and 'important'."); 20 21 test(function () { 22 document.querySelector('#dinamicallyStyle').style.cssText = "color: black !important;"; 23 var css_style = document.querySelector('#dinamicallyStyle').style.cssText; 24 assert_equals(css_style, "color: black !important;"); 25 }, "Style set dynamically via cssText without whitespace between '!' and 'important'."); 26 27 test(function () { 28 document.querySelector('#dinamicallyStyle').style.cssText = "color: black ! important;"; 29 var css_style = document.querySelector('#dinamicallyStyle').style.cssText; 30 assert_equals(css_style, "color: black !important;"); 31 }, "Style set dynamically via cssText with whitespace between '!' and 'important'."); 32 </script>