<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>CSSMediaRule deleteRule test</title>
<style id="style1">
@media all {
#test { color: red; }
* { color: green; }
}
</style>
<script>
function test() {
var styleSheet = document.getElementById('style1').sheet;
var mediaRule = styleSheet.cssRules[0];
mediaRule.deleteRule(0);
}
</script>
</head>
<body onload="test();">
<p id="test">This line should be green.</p>
</body>
</html>