transition-important.html (776B)
1 <!DOCTYPE html> 2 <title>CSS Transitions Test: !important property</title> 3 <link rel="help" href="https://drafts.csswg.org/css-cascade-5/#cascade-sort"> 4 <script src="/resources/testharness.js" type="text/javascript"></script> 5 <script src="/resources/testharnessreport.js" type="text/javascript"></script> 6 <style> 7 #target { 8 width: 200px; 9 height: 200px; 10 background-color: green; 11 transition: background-color 100s; 12 } 13 .red { 14 background-color: red !important; 15 } 16 </style> 17 <div id="target"></div> 18 <script> 19 test(t => { 20 assert_equals(getComputedStyle(target).backgroundColor, "rgb(0, 128, 0)"); 21 target.className = "red"; 22 assert_equals(getComputedStyle(target).backgroundColor, "rgb(0, 128, 0)"); 23 }, "!important should not override transition"); 24 </script>