summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/dom/StyleSheet/ownerNode-lifetime-2.html
blob: ca6fa16ea4fb31bf09555168aa5c1b80b1c6812d (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
31
32
33
34
35
36
37
<html>
<link rel="stylesheet" type="text/css" href="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>