OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <title>CSS3 media query test: deleteMedium throwing exception.</title> | 3 <title>CSS3 media query test: deleteMedium throwing exception.</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 <style type="text/css"> | 6 <style type="text/css"> |
7 @media all and (color) { | 7 @media all and (color) { |
8 p#result { color: green;} | 8 p#result { color: green;} |
9 } | 9 } |
10 </style> | 10 </style> |
11 | 11 |
12 <script language="javascript"> | 12 <script language="javascript"> |
13 function test() { | 13 function test() { |
14 try { | 14 try { |
15 document.styleSheets[0].cssRules[0].media.deleteMedium("all and ("); | 15 document.styleSheets[0].cssRules[0].media.deleteMedium("all and ("); |
16 document.getElementById("result").innerHTML = "Success. This text should
be green."; | 16 document.getElementById("result").innerHTML = "Failure. 'all and (' is n
ot a valid media query and should become 'not all'. Not all is not present in th
e media rule, hence a DOMException.NOT_FOUND_ERR should be thrown." |
17 } | 17 } |
18 catch(e) { | 18 catch(e) { |
19 document.getElementById("result").innerHTML = "Failure. 'all and (' is n
ot a valid medium and should be ignored." | 19 if (e.code == DOMException.NOT_FOUND_ERR) |
20 document.getElementById("details").innerHTML = "Following exception was
caught: " + e; | 20 document.getElementById("result").innerHTML = "Success. This text sh
ould be green."; |
| 21 else { |
| 22 document.getElementById("result").innerHTML = "Failure. Wrong except
ion thrown. Expected DOMException.NOT_FOUND_ERR."; |
| 23 document.getElementById("details").innerHTML = "Following exception
was caught: " + e; |
| 24 } |
21 } | 25 } |
22 } | 26 } |
23 </script> | 27 </script> |
24 | 28 |
25 | 29 |
26 </head> | 30 </head> |
27 <body onload="test()"> | 31 <body onload="test()"> |
28 <p>The text below should read "Success." </p> | 32 <p>The text below should read "Success." </p> |
29 <p id="result">Failure: test not run.</p> | 33 <p id="result">Failure: test not run.</p> |
30 <p id="details"></p> | 34 <p id="details"></p> |
31 </body> | 35 </body> |
32 </html> | 36 </html> |
OLD | NEW |