blob: 18cd958ef9d20d6e36492e5912f2b24e4a8824b2 (
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
|
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function log(msg)
{
document.body.appendChild(document.createTextNode(msg));
}
function appendItem(list, caption)
{
var item = document.createElement('li');
item.appendChild(document.createTextNode(caption));
list.appendChild(item);
}
function runTests()
{
if (window.testRunner)
testRunner.dumpAsText();
var fragment = document.createDocumentFragment();
var list = document.createElement('ul');
var i;
for (i = 0; i < 5; i++)
appendItem(list, 'item ' + i);
fragment.appendChild(list);
document.addEventListener("DOMNodeRemoved", function() {
appendItem(list, 'item ' + i++);
}, false);
document.body.appendChild(fragment);
list.textContent = '';
if (list.childNodes.length == 0)
log('PASS: No infinite loop.')
else
log('FAIL: Has too many children.')
}
</script>
</head>
<body onload="runTests();">
</body>
</html>
|