<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> |