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 {}", "screen and (color), tv", "Medi
a query error #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 ]; | 20 ]; |
21 var cdataNode = document.getElementById("sheet").firstChild; | 21 var cdataNode = document.getElementById("sheet").firstChild; |
22 for (var i=0; i < tests.length; i++) { | 22 for (var i=0; i < tests.length; i++) { |
23 cdataNode.data = tests[i][0]; | 23 cdataNode.data = tests[i][0]; |
24 if (document.styleSheets[0].cssRules.length > 0 && | 24 if (document.styleSheets[0].cssRules.length > 0 && |
25 document.styleSheets[0].cssRules[0].type == 4) { | 25 document.styleSheets[0].cssRules[0].type == 4) { |
26 result = document.styleSheets[0].cssRules[0].media.mediaText; | 26 result = document.styleSheets[0].cssRules[0].media.mediaText; |
27 } | 27 } |
28 else { | 28 else { |
29 result = "MEDIA RULE DROPPED!"; | 29 result = "MEDIA RULE DROPPED!"; |
30 } | 30 } |
31 test(function() { | 31 test(function() { |
32 assert_equals(result, tests[i][1]); | 32 assert_equals(result, tests[i][1]); |
33 }, tests[i][2]); | 33 }, tests[i][2]); |
34 } | 34 } |
35 </script> | 35 </script> |
36 </head> | 36 </head> |
37 <body> | 37 <body> |
38 <div id="log"></div> | 38 <div id="log"></div> |
39 </body> | 39 </body> |
40 </html> | 40 </html> |
OLD | NEW |