summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/media/mq-js-media-except-01.html
blob: a5f684c0c75258b938bfeb6ab88dbcdf35a73218 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<html>
<head>
<title>CSS3 media query test: deleteMedium throwing exception.</title>
<link rel="help" href="http://www.w3.org/TR/css3-mediaqueries/" />

<style type="text/css">
@media all and (color) {
p#result { color: green;}
}
</style>

<script language="javascript">
function test() {
    try {
        document.styleSheets[0].cssRules[0].media.deleteMedium("all and (");
        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."
    }
    catch(e) {
        if (e.code == DOMException.NOT_FOUND_ERR)
            document.getElementById("result").innerHTML = "Success. This text should be green.";
        else {
            document.getElementById("result").innerHTML = "Failure. Wrong exception thrown. Expected DOMException.NOT_FOUND_ERR.";
            document.getElementById("details").innerHTML = "Following exception was caught: " + e;
        }
    }
}
</script>


</head>
<body onload="test()">
<p>The text below should read "Success." </p>
<p id="result">Failure: test not run.</p>
<p id="details"></p>
</body>
</html>