<script>
function test() {
    if (window.testRunner) testRunner.dumpAsText();
    var node = document.createElement("div");
    document.getElementById("replace").parentNode.replaceChild(node, document.getElementById("replace"));
    document.getElementById("result").appendChild(document.createTextNode(node.parentNode));
}
</script>
<body onload="test()">
<p>This tests for a bug in replaceChild where it would fail to replace an element if it was the first child of its container.
See <a href="https://bugs.webkit.org/show_bug.cgi?id=6782">bug 6782</a> for details.
If the test is successful you will see an object description below, and if it fails you will see "null".</p>
<div><div id="replace"></div></div>
<div id="result"></div></body>
