blob: 9e28bab661ebbde68ed03c1f5c5c2948d5bd3afd [file] [log] [blame]
<html>
<head>
<style>
@media all { #test { color: green; } }
</style>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<div id="test"></div>
<script>
description("Test that CSS stylesheets lacking wrappers are pruned from detached CSSOM subtrees. " +
"This is surprising behavior, but it's a very rare situation, and the behavior actually matches " +
"what both WebKit and Gecko do for DOM nodes in detached subtrees.");
shouldBe('getMatchedCSSRules(document.getElementById("test")).length', '1');
rule = getMatchedCSSRules(document.getElementById("test")).item(0);
debug("Removing &lt;style>...");
document.head.removeChild(document.getElementsByTagName("style")[0]);
shouldBe("rule.parentRule", "null");
shouldBe('getMatchedCSSRules(document.getElementById("test"))', 'null');
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>