| 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 } catch (e) { | 22 } catch (e) { |
| 23 document.getElementById("result").innerHTML = "Failure. ,,,, should be v
alid media descriptor."; | 23 document.getElementById("result").innerHTML = "Failure. ,,,, should be v
alid media descriptor."; |
| 24 document.getElementById("details").innerHTML = "Caught exception: " + e; | 24 document.getElementById("details").innerHTML = "Caught exception: " + e; |
| 25 return; | 25 return; |
| 26 } | 26 } |
| 27 try { | 27 try { |
| 28 // this should throw | 28 // this shouldn't throw |
| 29 document.styleSheets[0].cssRules[1].media.mediaText = ",,,,"; | 29 document.styleSheets[0].cssRules[1].media.mediaText = ",,,,"; |
| 30 document.getElementById("result").innerHTML = "Failure. No exception thr
own."; | 30 document.getElementById("result").innerHTML = "Success. This text should
be green."; |
| 31 } catch (e) { | 31 } catch (e) { |
| 32 document.getElementById("result").innerHTML = "Success. This text should
be green."; | 32 document.getElementById("result").innerHTML = "Failure. Exception thrown
."; |
| 33 document.getElementById("details").innerHTML = "Caught exception: " + e; | 33 document.getElementById("details").innerHTML = "Caught exception: " + e; |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 </script> | 36 </script> |
| 37 | 37 |
| 38 </head> | 38 </head> |
| 39 <body onload="test()"> | 39 <body onload="test()"> |
| 40 <p id="result">Failure: test not run</p> | 40 <p id="result">Failure: test not run</p> |
| 41 <p id="details">aaa</p> | 41 <p id="details"></p> |
| 42 </body> | 42 </body> |
| 43 </html> | 43 </html> |
| OLD | NEW |