OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <title>CSS3 media query test: @media css rule media.mediaText property parsing,
media query syntax error should be handled correctly.</title> | 3 <title>CSS3 media query test: @media css rule media.mediaText property parsing,
media query syntax error should be handled correctly.</title> |
4 <link rel="help" href="http://www.w3.org/TR/CSS21/media.html" /> | 4 <link rel="help" href="http://www.w3.org/TR/CSS21/media.html" /> |
| 5 <link rel="help" href="http://www.w3.org/TR/cssom/#dom-medialist-mediatext" /> |
5 | 6 |
6 <style type="text/css"> | 7 <style type="text/css"> |
7 p#result {color: green} | 8 p#result {color: green} |
8 | 9 |
9 @media not screen { | 10 @media not screen { |
10 /* query will be modified from javascript */ | 11 /* query will be modified from javascript */ |
11 /* the manipulation contains syntax error, and should fail */ | 12 /* the manipulation contains syntax error, and should fail */ |
12 p#result {color: red} | 13 p#result {color: red} |
13 } | 14 } |
14 | 15 |
15 @media screen and resolution > 40dpi { | 16 @media screen and resolution > 40dpi { |
16 /* media query with syntax error should fail */ | 17 /* media query with syntax error should fail */ |
17 /* corresponding DOM manipulation will fail */ | 18 /* corresponding DOM manipulation will fail */ |
18 p#result {color: red} | 19 p#result {color: red} |
19 } | 20 } |
20 </style> | 21 </style> |
21 <script language="javascript"> | 22 <script language="javascript"> |
22 function test() { | 23 function test() { |
23 try { | 24 try { |
24 // this should throw | 25 // this should throw |
25 document.styleSheets[0].cssRules[1].media.mediaText = "screen and resolu
tion > 40dpi"; | 26 document.styleSheets[0].cssRules[1].media.mediaText = "screen and resolu
tion > 40dpi"; |
| 27 document.getElementById("result").innerHTML = "This text should be green
."; |
26 } catch (e) { | 28 } catch (e) { |
27 document.getElementById("result").innerHTML = "This text should be green
."; | |
28 document.getElementById("details").innerHTML = "Caught exception: " + e; | 29 document.getElementById("details").innerHTML = "Caught exception: " + e; |
29 } | 30 } |
30 } | 31 } |
31 </script> | 32 </script> |
32 | 33 |
33 </head> | 34 </head> |
34 <body onload="test()"> | 35 <body onload="test()"> |
35 <p id="result">Failure: test not run</p> | 36 <p id="result">Failure: test not run</p> |
36 <p id="details"></p> | 37 <p id="details"></p> |
37 </body> | 38 </body> |
38 </html> | 39 </html> |
OLD | NEW |