3 <script src=
"../../resources/js-test.js"></script>
12 src: local('Courier');
16 @page :left { top:
0 }
18 #t0 { content:
"APPLIED" }
20 @import url(
"../../cssom/resources/import.css");
26 #t1 { content:
"APPLIED" }
32 <span id=t0 class=test
></span>
33 <span id=t1 class=test
></span>
35 description("Test nested at-rules.");
37 evalAndLog("rules = document.styleSheets[1].cssRules");
38 shouldEvaluateTo("rules.length", 2);
40 shouldBe("rules[0].type", "CSSRule.STYLE_RULE");
41 shouldBe("rules[1].type", "CSSRule.MEDIA_RULE");
42 shouldEvaluateTo("rules[1].cssRules.length", 2);
43 shouldBe("rules[1].cssRules[0].type", "CSSRule.MEDIA_RULE");
44 shouldEvaluateTo("rules[1].cssRules[0].cssRules.length", 3);
45 shouldBe("rules[1].cssRules[0].cssRules[0].type", "CSSRule.FONT_FACE_RULE");
46 shouldBe("rules[1].cssRules[0].cssRules[1].type", "CSSRule.PAGE_RULE");
47 shouldBe("rules[1].cssRules[0].cssRules[2].type", "CSSRule.STYLE_RULE");
48 shouldBe("rules[1].cssRules[0].cssRules[0].parentStyleSheet", "document.styleSheets[1]");
49 shouldBe("rules[1].cssRules[0].cssRules[1].parentStyleSheet", "document.styleSheets[1]");
50 shouldBe("rules[1].cssRules[0].cssRules[2].parentStyleSheet", "document.styleSheets[1]");
52 shouldBe("rules[1].cssRules[1].type", "CSSRule.MEDIA_RULE");
53 shouldEvaluateTo("rules[1].cssRules[1].cssRules.length", 1);
54 shouldBe("rules[1].cssRules[1].cssRules[0].type", "CSSRule.MEDIA_RULE");
55 evalAndLog("rules[1].cssRules[1].insertRule('@media all { @page :left { top: 0; } }', 1)");
56 shouldEvaluateTo("rules[1].cssRules[1].cssRules.length", 2);
57 shouldBe("rules[1].cssRules[1].cssRules[1].type", "CSSRule.MEDIA_RULE");
58 shouldBe("rules[1].cssRules[1].cssRules[1].cssRules[0].type", "CSSRule.PAGE_RULE");
60 shouldBeEqualToString("getComputedStyle(document.getElementById('t0')).content", '"APPLIED"');
61 shouldBeEqualToString("getComputedStyle(document.getElementById('t1')).content", '"UNTOUCHED"');