OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <h1 id="h1"></h1> |
| 3 <pre id="res"></pre> |
| 4 <script> |
| 5 if (window.testRunner) { |
| 6 testRunner.dumpAsText(); |
| 7 testRunner.waitUntilDone(); |
| 8 } |
| 9 |
| 10 var result = ""; |
| 11 |
| 12 function expectComputedOnH1(name, expected) { |
| 13 var value = getComputedStyle(h1)[name]; |
| 14 result += name + ": "; |
| 15 if (value == expected) |
| 16 result += "PASS\n"; |
| 17 else |
| 18 result += "FAIL - " + value + ", expected " + expected + "\n"; |
| 19 } |
| 20 |
| 21 function sheetLoaded() { |
| 22 expectComputedOnH1("backgroundColor", "rgb(0, 128, 0)"); |
| 23 expectComputedOnH1("color", "rgb(0, 128, 0)"); |
| 24 res.innerHTML = result; |
| 25 if (window.testRunner) |
| 26 testRunner.notifyDone(); |
| 27 } |
| 28 |
| 29 var style = document.createElement("style"); |
| 30 style.appendChild(document.createTextNode("@import url(http://localhost:8080
/css/resources/slow-loading-sheet.php?color=green); h1{color:green}")); |
| 31 style.setAttribute("onload", "sheetLoaded()"); |
| 32 document.head.appendChild(style); |
| 33 |
| 34 document.body.offsetTop; |
| 35 expectComputedOnH1("backgroundColor", "rgba(0, 0, 0, 0)"); |
| 36 expectComputedOnH1("color", "rgb(0, 0, 0)"); |
| 37 |
| 38 </script> |
OLD | NEW |