style_disabled.html (1201B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>HTML Test: The style should not be applied if it is disabled</title> 6 <link rel="author" title="Intel" href="http://www.intel.com/"> 7 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-style-element"> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <style> 11 #test { 12 width: 100px; 13 } 14 </style> 15 <style id="style"> 16 #test { 17 width: 50px; 18 } 19 </style> 20 </head> 21 <body> 22 <div id="log"></div> 23 <div id="test"></div> 24 <script> 25 test(function() { 26 var testElement = document.getElementById("test"); 27 var style = document.getElementById("style"); 28 var width1, width2; 29 30 width1 = window.getComputedStyle(testElement)["width"]; 31 assert_equals(width1, "50px", "The style should be applied."); 32 33 style.disabled = true; 34 width2 = window.getComputedStyle(testElement)["width"]; 35 assert_equals(width2, "100px", "The style should not be applied."); 36 }, "The style is not applied when it is disabled"); 37 </script> 38 </body> 39 </html>