summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/css/media-rule-dyn.html
blob: a6bdc75b37b5bc47e130fd3951a18cb19cbff790 (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
<html>
    <head>
        <style id="style1">
            @media all { .test { color: green; } }
        </style>
        <script>
            function runTest() {
                if (window.testRunner)
                    testRunner.dumpAsText();

                var styleSheet = document.getElementById('style1').sheet;
                var mediaRule = styleSheet.cssRules[0];

                try {
                    var index = mediaRule.insertRule("p {color: red; }", 0);
                    if (mediaRule.cssRules.length == 2) {
                        mediaRule.deleteRule(0);
                        if (mediaRule.cssRules.length == 1)
                            document.getElementById('result').innerHTML = 'SUCCESS';            
                    }
                } catch (e) {
                    document.getElementById('result').innerHTML = 'EXCEPTION';            
                }
            }
        </script>
    </head>
    <body onload="runTest();">
        <div id="result">FAILURE</div>
    </body>
</html>