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/DOM-Level-2-Style/css.html#CSS-CSSMe
diaRule" /> | 5 <link rel="help" href="http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSMe
diaRule" /> |
6 <!-- this test shows slight disconnect between css media queries and html4 media
descriptors --> | 6 <!-- this test shows slight disconnect between css media queries and html4 media
descriptors --> |
7 <style type="text/css"> | 7 <style type="text/css"> |
8 p#result {color: green} | 8 p#result {color: green} |
9 | 9 |
10 @media braille { | 10 @media braille { |
11 /* query will be modified from javascript */ | 11 /* query will be modified from javascript */ |
12 /* the manipulation contains syntax error, and should fail */ | 12 /* the manipulation contains syntax error, and should fail */ |
13 p#result {color: red} | 13 p#result {color: red} |
14 } | 14 } |
15 } | 15 } |
16 </style> | 16 </style> |
17 <script language="javascript"> | 17 <script language="javascript"> |
18 function test() { | 18 function test() { |
19 try { | 19 try { |
20 // this shouldn't throw | 20 // this shouldn't throw |
21 document.styleSheets[0].media.mediaText = ",,,,"; | 21 document.styleSheets[0].media.mediaText = ",,,,"; |
| 22 document.getElementById("result").innerHTML = "Success. This text should
be green."; |
22 } catch (e) { | 23 } catch (e) { |
23 document.getElementById("result").innerHTML = "Failure. ,,,, should be v
alid media descriptor."; | 24 document.getElementById("result").innerHTML = "Failure. ,,,, should be v
alid media descriptor."; |
24 document.getElementById("details").innerHTML = "Caught exception: " + e; | 25 document.getElementById("details").innerHTML = "Caught exception: " + e; |
25 return; | 26 return; |
26 } | 27 } |
27 try { | 28 try { |
28 // this shouldn't throw | 29 // this shouldn't throw |
29 document.styleSheets[0].cssRules[1].media.mediaText = ",,,,"; | 30 document.styleSheets[0].cssRules[1].media.mediaText = ",,,,"; |
30 document.getElementById("result").innerHTML = "Success. This text should
be green."; | 31 document.getElementById("result").innerHTML = "Success. This text should
be green."; |
31 } catch (e) { | 32 } catch (e) { |
32 document.getElementById("result").innerHTML = "Failure. Exception thrown
."; | 33 document.getElementById("result").innerHTML = "Failure. Exception thrown
."; |
33 document.getElementById("details").innerHTML = "Caught exception: " + e; | 34 document.getElementById("details").innerHTML = "Caught exception: " + e; |
34 } | 35 } |
35 } | 36 } |
36 </script> | 37 </script> |
37 | 38 |
38 </head> | 39 </head> |
39 <body onload="test()"> | 40 <body onload="test()"> |
40 <p id="result">Failure: test not run</p> | 41 <p id="result">Failure: test not run</p> |
41 <p id="details"></p> | 42 <p id="details"></p> |
42 </body> | 43 </body> |
43 </html> | 44 </html> |
OLD | NEW |