| <!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> |