<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<div id="test">
    <div id="console"></div>
</body>
<script>
window.jsTestIsAsync = true;

var element, children;

window.onload = function()
{
    element = document.createElement("div");
    var child = element.appendChild(document.createElement("div"));
    child.id = "child";

    children = element.children;
    children.namedItem("child");

    var doc = document.implementation.createHTMLDocument();
    doc.adoptNode(element);
    element.removeChild(child);
    child = null;

    gc();
    setTimeout(step2, 100);
}

function step2()
{
    document.adoptNode(element);
    shouldBeNull("children.namedItem('child')");
    finishJSTest();
}
</script>
<script src="../../resources/js-test-post.js"></script>
</html>
