<html>
<head>
<script>

function debug(str)
{
    document.getElementById('console').appendChild(document.createTextNode(str))
}

function runTest()
{
    if (window.testRunner)
        testRunner.dumpAsText();

    try {
        document.appendChild(document.createElementNS("http://www.w3.org/1999/xhtml", "html"));
        debug("FAILURE: Did not throw exception and should throw node hierarchy error.");
        return;
    } catch (e) {
        if (e.code != 3) {
            debug("FAILURE: Threw an exception with a code other than 3; should throw node hierarchy error.");
            return;
        }
    }

    debug('SUCCESS!')
}

</script>
</head>
<body onload="runTest();">
This tests that a document only supports one document element.
If the test is successful, 'SUCCESS' will be displayed below, otherwise 'FAILURE' and a reason will be displayed.
<pre id="console"></pre>
</body>
</html>
