OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <title>CSS3 media query test: stylesheet media.mediaText = parsing, media descri
ptor fallback in document.StyleSheet.media.mediaText</title> | 3 <title>CSS3 media query test: stylesheet media.mediaText = parsing, media de
scriptor fallback in document.StyleSheet.media.mediaText</title> |
4 <link rel="help" href="http://www.w3.org/TR/css3-mediaqueries/" /> | 4 <link rel="help" href="http://www.w3.org/TR/css3-mediaqueries/"> |
5 | 5 |
6 <!-- the media property of stylesheet below will be manipulated, and | 6 <!-- the media property of stylesheet below will be manipulated, and the manipul
ation should fail. --> |
7 manipulation should respect html media descriptor forward-compatible syntax. | |
8 This means the manipulation should succeed. --> | |
9 <style type="text/css"> | 7 <style type="text/css"> |
10 | 8 |
11 p#result { color: green;} | 9 p#result { color: blue } |
12 | 10 |
13 @media screen and resolution > 40dpi { | 11 @media screen and resolution > 40dpi { |
14 /* media query with syntax error should fail */ | 12 /* media query with syntax error should fail */ |
15 /* corresponding DOM manipulation to the mediaText of the stylesheet will succee
d */ | 13 p#result { color: red } |
16 p#result { color: red;} | |
17 | 14 |
18 } | 15 } |
19 </style> | 16 </style> |
20 <script language="javascript"> | 17 <script> |
21 function test() { | 18 function test() { |
22 // this should not throw, because StyleSheet should respect Media Description
forward-compatible syntax | |
23 document.styleSheets[0].media.mediaText = "screen and resolution > 40dpi"; | 19 document.styleSheets[0].media.mediaText = "screen and resolution > 40dpi"; |
24 document.getElementById("result").innerHTML = "This text should be green."; | 20 document.getElementById("result").innerHTML = "This text should neither be bl
ue nor red."; |
25 } | 21 } |
26 </script> | 22 </script> |
27 | 23 |
28 | 24 |
29 </head> | 25 </head> |
30 <body onload="test()"> | 26 <body onload="test()"> |
31 <p id="result">Failure: test not run</p> | 27 <p id="result">Failure: test not run</p> |
32 </body> | 28 </body> |
33 </html> | 29 </html> |
OLD | NEW |