Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / media / mq-js-media-except-01.html
bloba5f684c0c75258b938bfeb6ab88dbcdf35a73218
1 <html>
2 <head>
3 <title>CSS3 media query test: deleteMedium throwing exception.</title>
4 <link rel="help" href="http://www.w3.org/TR/css3-mediaqueries/" />
6 <style type="text/css">
7 @media all and (color) {
8 p#result { color: green;}
10 </style>
12 <script language="javascript">
13 function test() {
14 try {
15 document.styleSheets[0].cssRules[0].media.deleteMedium("all and (");
16 document.getElementById("result").innerHTML = "Failure. 'all and (' is not a valid media query and should become 'not all'. Not all is not present in the media rule, hence a DOMException.NOT_FOUND_ERR should be thrown."
18 catch(e) {
19 if (e.code == DOMException.NOT_FOUND_ERR)
20 document.getElementById("result").innerHTML = "Success. This text should be green.";
21 else {
22 document.getElementById("result").innerHTML = "Failure. Wrong exception thrown. Expected DOMException.NOT_FOUND_ERR.";
23 document.getElementById("details").innerHTML = "Following exception was caught: " + e;
27 </script>
30 </head>
31 <body onload="test()">
32 <p>The text below should read "Success." </p>
33 <p id="result">Failure: test not run.</p>
34 <p id="details"></p>
35 </body>
36 </html>