summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/gc-5.html
blob: 7475b20b30c50fa80dd68d727b9c7272d8294123 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
<head>
<script>
function doit()
{
    var B = document.getElementById("span-B");
    B.customProperty = "B";
    B.nextSibling.customProperty = "D";

    document.getElementById("div").innerHTML = "<span>replacement content</span>";

    // create lots of objects to force a garbage collection
    var i = 0;
    var s;
    while (i < 5000) {
        i = i+1.11;
	s = s + " ";
    }

    var output= document.getElementById("output");

    output.innerHTML += B.customProperty + "<BR>";
    if (B.nextSibling) {
        output.innerHTML += B.nextSibling.customProperty + "<BR>";
    }
}

if (window.testRunner) {
    testRunner.dumpAsText();
}

</script>
</head>

<body onload="doit()">
<div style="border: 1px solid red">
<p>
This test verifies that DOM nodes are retained because a wrapper exists and is protected for a sibling. A wrapper need not exist for the node itself or for an ancestor.
</p>
<p>
The output should be the following pieces of text on lines by themselves: "replacement content", "B", "D".
</p>
</div>
<div id="div">
<span id="span-A"><span id="span-B"><span id="span-C">original span</span></span>
<span id="span-D"> xx </span>
</span>
</div>
<div id="output">
</div>
</body>