blob: 2afcac94c6cb5684dce470980f847c71cbf9ca60 [file] [log] [blame]
<html>
<head>
<script>
function debug(str)
{
document.getElementById('console').appendChild(document.createTextNode(str))
}
function runTest()
{
if (window.testRunner)
testRunner.dumpAsText();
try {
// add two docType elements to test handling multiple addition of docTypes, since document has no docType initially
document.appendChild(document.implementation.createDocumentType("example", "http://www.example.com/", "myDoc.dtd"));
document.appendChild(document.implementation.createDocumentType("example", "http://www.example.com/", "myDoc.dtd"));
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 having one doctype.
If the test is successful, 'SUCCESS' will be displayed below, otherwise 'FAILURE' and a reason will be displayed.
<pre id="console"></pre>
</body>
</html>