Regression(r188105): Seems to have caused crashes during PLT on some iPads
[WebKit-https.git] / LayoutTests / fast / css / nested-at-rules.html
1 <html>
2 <head>
3 <script src="../../resources/js-test-pre.js"></script>
4 <style>
5 .test {
6     content: "UNTOUCHED";
7 }
8
9 @media all {
10     @media all {
11         @font-face {
12             src: local('Courier');
13             font-family: Courier;
14         }
15
16         @page :left { top: 0 }
17
18         #t0 { content: "APPLIED" }
19
20         @import url("../../cssom/resources/import.css");
21         @charset "UTF-8";
22         @namespace "";
23     }
24     @media all {
25         @media none {
26             #t1 { content: "APPLIED" }
27         }
28     }
29 }
30 </style>
31 <body>
32 <span id=t0 class=test></span>
33 <span id=t1 class=test></span>
34 <script>
35 description("Test nested at-rules.");
36
37 evalAndLog("rules = document.styleSheets[1].cssRules");
38 shouldEvaluateTo("rules.length", 2);
39
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]");
51
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");
59
60 shouldBeEqualToString("getComputedStyle(document.getElementById('t0')).content", "APPLIED");
61 shouldBeEqualToString("getComputedStyle(document.getElementById('t1')).content", "UNTOUCHED");
62 </script>
63 <script src="../../resources/js-test-post.js"></script>