94 lines
2.7 KiB
HTML
94 lines
2.7 KiB
HTML
<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 uri = 'http://www.example.org';
|
|
|
|
// Both null namespaceURI and qname
|
|
try {
|
|
var doc = document.implementation.createDocument(null, null, null)
|
|
|
|
if (doc.documentElement) {
|
|
debug('FAILURE: Document created should not have a document element')
|
|
return;
|
|
}
|
|
} catch (e) {
|
|
debug('FAILURE: Got exception ' + e.message + ' when creating document with null namespaceURI and qualifiedName')
|
|
return;
|
|
}
|
|
|
|
// Both empty namespaceURI and qname
|
|
try {
|
|
var doc = document.implementation.createDocument('', '', null)
|
|
|
|
if (doc.documentElement) {
|
|
debug('FAILURE: Document created should not have a document element')
|
|
return;
|
|
}
|
|
} catch (e) {
|
|
debug('FAILURE: Got exception ' + e.message + ' when creating document with empty namespaceURI and qualifiedName')
|
|
return;
|
|
}
|
|
|
|
// Null namespaceURI with qname
|
|
try {
|
|
var doc = document.implementation.createDocument(null, 'test', null)
|
|
|
|
if (!doc.documentElement) {
|
|
debug('FAILURE: Document created should have a document element')
|
|
return;
|
|
}
|
|
|
|
} catch (e) {
|
|
debug('FAILURE: Got exception ' + e.message + ' when creating document with null namespaceURI')
|
|
return;
|
|
}
|
|
|
|
// Empty namespaceURI with qname
|
|
try {
|
|
var doc = document.implementation.createDocument('', 'test', null)
|
|
|
|
if (!doc.documentElement) {
|
|
debug('FAILURE: Document created should have a document element')
|
|
return;
|
|
}
|
|
|
|
} catch (e) {
|
|
debug('FAILURE: Got exception ' + e.message + ' when creating document with empty namespaceURI')
|
|
return;
|
|
}
|
|
|
|
// namespaceURI with empty qname
|
|
try {
|
|
var doc = document.implementation.createDocument(uri, '', null)
|
|
|
|
if (doc.documentElement) {
|
|
debug('FAILURE: Document created should not have a document element')
|
|
return;
|
|
}
|
|
|
|
} catch (e) {
|
|
debug('FAILURE: Got exception ' + e.message + ' when creating document with empty namespaceURI')
|
|
return;
|
|
}
|
|
|
|
debug('SUCCESS!')
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
<body onload="runTests();">
|
|
This tests that it should be possible to create documents with empty/null qnames and namespaceURIs. If the test is successful, 'SUCCESS' will be displayed below, otherwise 'FAILURE' and a reason will be displayed.
|
|
<pre id="console">
|
|
</pre>
|
|
</body>
|
|
</html>
|