<html>
<head>
<script>
function debug(str) {
pre = document.getElementById('console');
txt = document.createTextNode(str)
pre.appendChild(txt)
}
function runTests() {
if (window.testRunner)
testRunner.dumpAsText();
var xhtmlURI = 'http://www.w3.org/1999/xhtml'
var doc = document.implementation.createDocument(xhtmlURI, 'html', null)
if (!doc.documentElement) {
debug('FAILURE: document has no document element')
return;
}
if (doc.documentElement.nodeName != 'html') {
debug('FAILURE: document element has wrong name')
return;
}
if (doc.documentElement.namespaceURI != xhtmlURI) {
debug('FAILURE: document element has wrong namespace URI')
return;
}
debug('SUCCESS!')
}
</script>
</head>
<body onload="runTests();">
This tests that a document created by createDocument has a document element, and that the document element has the correct name and namespace URI. If the test is successful, 'SUCCESS' will be displayed below, otherwise 'FAILURE' and a reason will be displayed.
<pre id="console">
</pre>
</body>
</html>