| OLD | NEW | 
 | (Empty) | 
|   1 <!DOCTYPE HTML> |  | 
|   2 <html> |  | 
|   3 <head> |  | 
|   4 <style> |  | 
|   5   .styled { |  | 
|   6       background-color: red; |  | 
|   7       width: 0; |  | 
|   8       height: 100px; |  | 
|   9   } |  | 
|  10 </style> |  | 
|  11 <script src="../fast/js/resources/js-test-pre.js"></script> |  | 
|  12 </head> |  | 
|  13 <body> |  | 
|  14 <p>This test requires testRunner and window.internals.</p> |  | 
|  15 <div id="test" class="styled"></div> |  | 
|  16 <script> |  | 
|  17 function test() |  | 
|  18 { |  | 
|  19     if (!window.testRunner) |  | 
|  20         return; |  | 
|  21     testRunner.dumpAsText(); |  | 
|  22     window.testElement = document.getElementById("test"); |  | 
|  23     shouldBe("getComputedStyle(testElement).backgroundColor", "'rgb(255, 0, 0)'"
    ); |  | 
|  24     shouldBe("testElement.offsetWidth", "0"); |  | 
|  25  |  | 
|  26     if (!window.internals) |  | 
|  27         return; |  | 
|  28  |  | 
|  29     // The author style above should override this user style. |  | 
|  30     internals.insertUserCSS(document, "body .styled { background-color: green; w
    idth: 100px; }"); |  | 
|  31     shouldBe("getComputedStyle(testElement).backgroundColor", "'rgb(255, 0, 0)'"
    ); |  | 
|  32     shouldBe("testElement.offsetWidth", "0"); |  | 
|  33  |  | 
|  34     // Since this style is more specific, it should override the original author
     style above. |  | 
|  35     internals.insertAuthorCSS(document, "body .styled { background-color: green;
     width: 100px; }"); |  | 
|  36     shouldBe("getComputedStyle(testElement).backgroundColor", "'rgb(0, 128, 0)'"
    ); |  | 
|  37     shouldBe("testElement.offsetWidth", "100"); |  | 
|  38 } |  | 
|  39  |  | 
|  40 test(); |  | 
|  41 </script> |  | 
|  42 </body> |  | 
|  43 </html> |  | 
| OLD | NEW |