| 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 // Need to remove the stylesheet used to trigger the ignore-pending-styl
esheet | |
| 23 // behavior in order to not have pending stylesheets here. | |
| 24 document.head.removeChild(document.head.querySelector("style")); | |
| 25 | |
| 26 expectComputedOnH1("backgroundColor", "rgb(0, 128, 0)"); | |
| 27 expectComputedOnH1("color", "rgb(0, 128, 0)"); | |
| 28 | |
| 29 res.innerHTML = result; | |
| 30 if (window.testRunner) | |
| 31 testRunner.notifyDone(); | |
| 32 } | |
| 33 | |
| 34 // This style element is required to trigger updateLayoutTreeIgnorePendingSt
ylesheets | |
| 35 // while the main link css file has loaded while its import has not. | |
| 36 var style = document.createElement("style"); | |
| 37 style.appendChild(document.createTextNode("@import url(resources/slow-loadin
g-sheet.php?sleep=10000&color=pink);")); | |
| 38 document.head.appendChild(style); | |
| 39 | |
| 40 var link = document.createElement("link"); | |
| 41 link.setAttribute("onload", "sheetLoaded()"); | |
| 42 link.setAttribute("rel", "stylesheet"); | |
| 43 link.setAttribute("href", "data:text/css,@import url(http://localhost:8080/c
ss/resources/slow-loading-sheet.php?color=green); h1{color:green}"); | |
| 44 document.head.appendChild(link); | |
| 45 | |
| 46 document.body.offsetTop; | |
| 47 expectComputedOnH1("backgroundColor", "rgba(0, 0, 0, 0)"); | |
| 48 expectComputedOnH1("color", "rgb(0, 0, 0)"); | |
| 49 | |
| 50 </script> | |
| OLD | NEW |