| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| <style> |
| .test { |
| content: "UNTOUCHED"; |
| } |
| |
| @media all { |
| @media all { |
| @font-face { |
| src: local('Courier'); |
| font-family: Courier; |
| } |
| |
| @page :left { top: 0 } |
| |
| #t0 { content: "APPLIED" } |
| |
| @import url("../../cssom/resources/import.css"); |
| @charset "UTF-8"; |
| @namespace ""; |
| } |
| @media all { |
| @media none { |
| #t1 { content: "APPLIED" } |
| } |
| } |
| } |
| </style> |
| <body> |
| <span id=t0 class=test></span> |
| <span id=t1 class=test></span> |
| <script> |
| description("Test nested at-rules."); |
| |
| evalAndLog("rules = document.styleSheets[1].cssRules"); |
| shouldEvaluateTo("rules.length", 2); |
| |
| shouldBe("rules[0].type", "CSSRule.STYLE_RULE"); |
| shouldBe("rules[1].type", "CSSRule.MEDIA_RULE"); |
| shouldEvaluateTo("rules[1].cssRules.length", 2); |
| shouldBe("rules[1].cssRules[0].type", "CSSRule.MEDIA_RULE"); |
| shouldEvaluateTo("rules[1].cssRules[0].cssRules.length", 3); |
| shouldBe("rules[1].cssRules[0].cssRules[0].type", "CSSRule.FONT_FACE_RULE"); |
| shouldBe("rules[1].cssRules[0].cssRules[1].type", "CSSRule.PAGE_RULE"); |
| shouldBe("rules[1].cssRules[0].cssRules[2].type", "CSSRule.STYLE_RULE"); |
| shouldBe("rules[1].cssRules[0].cssRules[0].parentStyleSheet", "document.styleSheets[1]"); |
| shouldBe("rules[1].cssRules[0].cssRules[1].parentStyleSheet", "document.styleSheets[1]"); |
| shouldBe("rules[1].cssRules[0].cssRules[2].parentStyleSheet", "document.styleSheets[1]"); |
| |
| shouldBe("rules[1].cssRules[1].type", "CSSRule.MEDIA_RULE"); |
| shouldEvaluateTo("rules[1].cssRules[1].cssRules.length", 1); |
| shouldBe("rules[1].cssRules[1].cssRules[0].type", "CSSRule.MEDIA_RULE"); |
| evalAndLog("rules[1].cssRules[1].insertRule('@media all { @page :left { top: 0; } }', 1)"); |
| shouldEvaluateTo("rules[1].cssRules[1].cssRules.length", 2); |
| shouldBe("rules[1].cssRules[1].cssRules[1].type", "CSSRule.MEDIA_RULE"); |
| shouldBe("rules[1].cssRules[1].cssRules[1].cssRules[0].type", "CSSRule.PAGE_RULE"); |
| |
| shouldBeEqualToString("getComputedStyle(document.getElementById('t0')).content", "APPLIED"); |
| shouldBeEqualToString("getComputedStyle(document.getElementById('t1')).content", "UNTOUCHED"); |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |