3 <link rel=
"stylesheet" href=
"resources/redimport.css"/>
5 <div>Test for bug
<a href=
"https://bugs.webkit.org/show_bug.cgi?id=56981">56981</a>: CSSStyleSheet#insertRule doesn't work well with imported stylesheets
</div>
6 <div>You should see one PASS below.
</div>
7 <div id=
"testArea"></div>
9 if (window
.testRunner
) {
10 testRunner
.dumpAsText();
11 testRunner
.waitUntilDone();
14 var remainingTests
= 20;
18 var testArea
= document
.getElementById("testArea");
19 if (getComputedStyle(testArea
).backgroundColor
== "rgb(0, 128, 0)") {
20 testArea
.innerHTML
= 'PASS';
24 testArea
.innerHTML
= 'FAIL, backgroundColor was ' + getComputedStyle(testArea
).backgroundColor
;
27 testArea
.innerHTML
= 'FAIL, exception raised (' + e
.message
+ ')';
31 window
.setTimeout(test
, 25);
32 if (window
.testRunner
)
33 testRunner
.notifyDone();
36 function waitForSheetToFinishLoading()
38 if (document
.styleSheets
.length
&& document
.styleSheets
[0].rules
[1].styleSheet
) {
43 window
.setTimeout(waitForSheetToFinishLoading
, 10)
46 window
.onload = function() {
47 document
.styleSheets
[0].insertRule('@import "green.css";', 1);
49 // We need to wait some time to let the stylesheet load before testing.
50 window
.setTimeout(waitForSheetToFinishLoading
, 10);