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