Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / media / mq-js-media-except-03.html
blobc32e9558b2c9965e9027ce006046172e4715e26b
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">
7 <!-- this test shows there there is no disconnect between CSS media queries and HTML5 media descriptors -->
8 <style type="text/css">
10 p#result { color: red }
12 @media braille {
13 /* query will be modified from javascript */
14 /* the manipulation contains syntax error, and should fail */
15 p#result { color: red }
18 </style>
19 <script>
20 function test() {
21 try {
22 // This shouldn't throw.
23 document.styleSheets[0].media.mediaText = ",,,,";
24 document.getElementById("result").innerHTML = "Success. This text should not be red.";
25 } catch (e) {
26 document.getElementById("result").innerHTML = "Failure. ,,,, should be valid media descriptor.";
27 document.getElementById("details").innerHTML = "Caught exception: " + e;
28 return;
30 try {
31 // This shouldn't throw.
32 document.styleSheets[0].cssRules[1].media.mediaText = ",,,,";
33 document.getElementById("result").innerHTML = "Success. This text should not be red.";
34 } catch (e) {
35 document.getElementById("result").innerHTML = "Failure. Exception thrown.";
36 document.getElementById("details").innerHTML = "Caught exception: " + e;
39 </script>
41 </head>
42 <body onload="test()">
43 <p id="result">Failure: test not run</p>
44 <p id="details"></p>
45 </body>
46 </html>