Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
|
meade_UTC10
2016/10/17 02:58:44
You can omit the <html>, <head> and <body> tags.
| |
| 4 <title>@media CSSOM - inherited from CSSConditionRule</title> | |
| 5 <script src="../resources/testharness.js"></script> | |
| 6 <script src="../resources/testharnessreport.js"></script> | |
| 7 <style> | |
| 8 @media screen and (min-width: 480px) { | |
| 9 body { background-color: lightgreen; } | |
| 10 } | |
| 11 @media { | |
| 12 body { background-color: red; } | |
| 13 } | |
| 14 </style> | |
| 15 </head> | |
| 16 <body> | |
| 17 <p>Test for <a href="http://crbug.com/651792">bug 651792</a>.</p> | |
| 18 <script> | |
| 19 var rules = document.styleSheets[0].cssRules; | |
| 20 test(function(){ | |
| 21 assert_equals(CSSRule.STYLE_RULE,1); | |
| 22 assert_equals(CSSRule.MEDIA_RULE,4); | |
| 23 assert_equals(rules.length, 2); | |
| 24 assert_equals(rules[0].type, 4); | |
| 25 assert_equals(rules[0].cssRules.length, 1); | |
| 26 assert_equals(rules[0].cssRules[0].type, 1); | |
| 27 assert_equals(rules[0].media.mediaText, "screen and (min-width: 480px)") ; | |
| 28 assert_equals(rules[0].conditionText, "screen and (min-width: 480px)"); | |
| 29 assert_equals(rules[0].media.mediaText,rules[0].conditionText); | |
| 30 assert_equals(rules[0].cssText, | |
| 31 "@media screen and (min-width: 480px) { \n" + | |
| 32 " body { background-color: lightgreen; }\n" + | |
| 33 "}"); | |
| 34 }, "@media inherited from CSSConditionRule."); | |
|
meade_UTC10
2016/10/17 02:58:44
Nit: It'd be nice to have newlines around the indi
| |
| 35 test(function(){ | |
| 36 assert_equals(CSSRule.STYLE_RULE,1); | |
| 37 assert_equals(CSSRule.MEDIA_RULE,4); | |
| 38 assert_equals(rules.length, 2); | |
| 39 assert_equals(rules[1].type, 4); | |
| 40 assert_equals(rules[1].cssRules.length, 1); | |
| 41 assert_equals(rules[1].cssRules[0].type, 1); | |
| 42 assert_equals(rules[1].media.mediaText, ""); | |
| 43 assert_equals(rules[1].conditionText, ""); | |
| 44 assert_equals(rules[1].media.mediaText,rules[1].conditionText); | |
| 45 assert_equals(rules[1].cssText, | |
| 46 "@media { \n" + | |
| 47 " body { background-color: red; }\n" + | |
| 48 "}"); | |
| 49 }, "@media inherited from CSSConditionRule, empty media."); | |
| 50 </script> | |
| 51 </body> | |
| 52 </html> | |
| OLD | NEW |