2008-11-04 Anders Carlsson <andersca@apple.com>
[webkit/qt.git] / LayoutTests / fast / dom / gc-3.html
blob51730472af357ff9bdca3d28d0b3a56e2dbfcd25
1 <head>
2 <script>
3 function doit()
5 B = document.getElementById("span-B");
6 B.customProperty = "B";
8 document.getElementById("div").innerHTML = "<span>replacement content</span>";
10 // create lots of objects to force a garbage collection
11 var i = 0;
12 var s;
13 while (i < 5000) {
14 i = i+1.11;
15 s = s + " ";
18 var output= document.getElementById("output");
20 output.innerHTML += B.customProperty + "<BR>";
21 if (B.parentNode) {
22 output.innerHTML += "parent node exists<BR>";
24 if (B.firstChild) {
25 output.innerHTML += "child node exists<BR>";
29 if (window.layoutTestController) {
30 layoutTestController.dumpAsText();
33 </script>
34 </head>
36 <body onload="doit()">
37 <div style="border: 1px solid red">
38 <p>
39 This test verifies that DOM nodes are not retained just because a wrapper exists for a descendant. A wrapper must exist for the node itself or for an ancestor.
40 </p>
41 <p>
42 The output should be the following pieces of text on lines by themselves: "replacement content", "B", "child node exists".
43 </p>
44 </div>
45 <div id="div">
46 <span id="span-A"><span id="span-B"><span id="span-C">original span</span></span></span>
47 </div>
48 <div id="output">
49 </div>
50 </body>