Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / nested-at-rules.html
blobe3e4495f582c0f6d3dbf1838c1e613d1b864f4dc
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 <style>
5 .test {
6 content: "UNTOUCHED";
9 @media all {
10 @media all {
11 @font-face {
12 src: local('Courier');
13 font-family: Courier;
16 @page :left { top: 0 }
18 #t0 { content: "APPLIED" }
20 @import url("../../cssom/resources/import.css");
21 @charset "UTF-8";
22 @namespace "";
24 @media all {
25 @media none {
26 #t1 { content: "APPLIED" }
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.");
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"');
62 </script>