OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Media Query List syntax</title> | 4 <title>Media Query List syntax</title> |
5 <link rel="author" title="Rune Lillesveen" href="mailto:rune@opera.com"> | 5 <link rel="author" title="Rune Lillesveen" href="mailto:rune@opera.com"> |
6 <link rel="help" href="http://www.w3.org/TR/css3-mediaqueries/#syntax"> | 6 <link rel="help" href="http://www.w3.org/TR/css3-mediaqueries/#syntax"> |
7 <script type="text/javascript" src="../../resources/testharness.js"></script
> | 7 <script type="text/javascript" src="../../resources/testharness.js"></script
> |
8 <script type="text/javascript" src="../../resources/testharnessreport.js"></
script> | 8 <script type="text/javascript" src="../../resources/testharnessreport.js"></
script> |
9 <style id="sheet">/**/</style> | 9 <style id="sheet">/**/</style> |
10 <script> | 10 <script> |
11 | 11 |
12 var tests = [ | 12 var tests = [ |
13 [ "@media all, not,{}", "all, not all, not all" , "Media query error
#1" ], | 13 [ "@media all, not,{}", "all, not all, not all" , "Media query error
#1" ], |
14 [ "@media screen, all and f() {}", "screen, not all", "Media query e
rror #2" ], | 14 [ "@media screen, all and f() {}", "screen, not all", "Media query e
rror #2" ], |
15 [ "@media not and (color), #screen, screen {}", "not all, not all, s
creen", "Media query error #3" ], | 15 [ "@media not and (color), #screen, screen {}", "not all, not all, s
creen", "Media query error #3" ], |
16 [ "@media all; @media tv {}", "tv", "Media query error #4" ], | 16 [ "@media all; @media tv {}", "tv", "Media query error #4" ], |
17 [ "@media ({ block, }), tv {}", "not all, tv", "Media query error #5
" ], | 17 [ "@media ({ block, }), tv {}", "not all, tv", "Media query error #5
" ], |
18 [ "@media screen and(color), tv {}", "not all, tv", "Media query err
or #6" ], | 18 [ "@media screen and(color), tv {}", "not all, tv", "Media query err
or #6" ], |
19 [ "@media all and (color) and (f() {}), tv {}", "not all, tv", "Medi
a query error #7" ] | 19 [ "@media all and (color) and (f() {}), tv {}", "not all, tv", "Medi
a query error #7" ], |
| 20 [ "@media tv, all or (nothing) {}", "tv, not all", "Media query erro
r #8" ], |
| 21 [ "@media tv, all and (color) tv {}", "tv, not all", "Media query er
ror #9" ] |
20 ]; | 22 ]; |
21 var cdataNode = document.getElementById("sheet").firstChild; | 23 var cdataNode = document.getElementById("sheet").firstChild; |
22 for (var i=0; i < tests.length; i++) { | 24 for (var i=0; i < tests.length; i++) { |
23 cdataNode.data = tests[i][0]; | 25 cdataNode.data = tests[i][0]; |
24 if (document.styleSheets[0].cssRules.length > 0 && | 26 if (document.styleSheets[0].cssRules.length > 0 && |
25 document.styleSheets[0].cssRules[0].type == 4) { | 27 document.styleSheets[0].cssRules[0].type == 4) { |
26 result = document.styleSheets[0].cssRules[0].media.mediaText; | 28 result = document.styleSheets[0].cssRules[0].media.mediaText; |
27 } | 29 } |
28 else { | 30 else { |
29 result = "MEDIA RULE DROPPED!"; | 31 result = "MEDIA RULE DROPPED!"; |
30 } | 32 } |
31 test(function() { | 33 test(function() { |
32 assert_equals(result, tests[i][1]); | 34 assert_equals(result, tests[i][1]); |
33 }, tests[i][2]); | 35 }, tests[i][2]); |
34 } | 36 } |
35 </script> | 37 </script> |
36 </head> | 38 </head> |
37 <body> | 39 <body> |
38 <div id="log"></div> | 40 <div id="log"></div> |
39 </body> | 41 </body> |
40 </html> | 42 </html> |
OLD | NEW |