<html> | |
<link rel="stylesheet" type="text/css" src="theme.css"/> | |
<script> | |
function runTest() { | |
if (window.layoutTestController) | |
layoutTestController.dumpAsText(); | |
var linkElement = document.getElementsByTagName('link')[0]; | |
var styleSheet = linkElement.sheet; | |
// delete link element | |
linkElement.parentNode.removeChild(linkElement); | |
linkElement = null; | |
if (window.gc) { | |
window.gc(); | |
} else if (GCController) { | |
GCController.collect(); | |
} else { | |
for (var i = 0; i < 10000; i++) | |
new Object(); | |
} | |
styleSheet.ownerNode.cloneNode(); | |
document.getElementById("result").innerHTML = "Test passed."; | |
} | |
</script> | |
<body onload="runTest()"> | |
<p> | |
This test verifies that style sheet do not outlive their elements. | |
Since you can get back to the element with the ownerNode attribute, | |
it's important to keep the element alive. | |
</p> | |
<p id="result">TEST HAS NOT RUN YET.</p> | |
</body> | |
</html> |