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