<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<script>
description("createDocument tests modelled after mozilla's testing");
function ExpectedNotEnoughArgumentsMessage(num) {
return "\"TypeError: Failed to execute 'createDocumentType' on 'DOMImplementation': 3 arguments required, but only " + num + " present.\"";
}
shouldThrow("document.implementation.createDocumentType('foo')", ExpectedNotEnoughArgumentsMessage(1));
shouldThrow("document.implementation.createDocumentType('foo', null)", ExpectedNotEnoughArgumentsMessage(2));
shouldThrow("document.implementation.createDocumentType(undefined, undefined)", ExpectedNotEnoughArgumentsMessage(2));
shouldThrow("document.implementation.createDocumentType(null, undefined)", ExpectedNotEnoughArgumentsMessage(2));
shouldThrow("document.implementation.createDocumentType(undefined, null)", ExpectedNotEnoughArgumentsMessage(2));
shouldNotThrow("document.implementation.createDocumentType(undefined, undefined, null)");
shouldThrow("document.implementation.createDocumentType(null, null)", ExpectedNotEnoughArgumentsMessage(2));
shouldThrow("document.implementation.createDocumentType(null, '')", ExpectedNotEnoughArgumentsMessage(2));
shouldThrow("document.implementation.createDocumentType('', null)", ExpectedNotEnoughArgumentsMessage(2));
shouldThrow("document.implementation.createDocumentType('', '')", ExpectedNotEnoughArgumentsMessage(2));
shouldThrow("document.implementation.createDocumentType('a:', null, null)", '"InvalidCharacterError: Failed to execute \'createDocumentType\' on \'DOMImplementation\': The qualified name provided (\'a:\') has an empty local name."');
shouldThrow("document.implementation.createDocumentType(':foo', null, null)", '"InvalidCharacterError: Failed to execute \'createDocumentType\' on \'DOMImplementation\': The qualified name provided (\':foo\') has an empty namespace prefix."');
shouldThrow("document.implementation.createDocumentType(':', null, null)", '"InvalidCharacterError: Failed to execute \'createDocumentType\' on \'DOMImplementation\': The qualified name provided (\':\') has an empty namespace prefix."');
shouldNotThrow("document.implementation.createDocumentType('foo', null, null)");
shouldNotThrow("document.implementation.createDocumentType('foo:bar', null, null)");
shouldThrow("document.implementation.createDocumentType('foo::bar', null, null)", '"InvalidCharacterError: Failed to execute \'createDocumentType\' on \'DOMImplementation\': The qualified name provided (\'foo::bar\') contains multiple colons."');
shouldThrow("document.implementation.createDocumentType('\t:bar', null, null)", '"InvalidCharacterError: Failed to execute \'createDocumentType\' on \'DOMImplementation\': The qualified name provided (\'\t:bar\') contains the invalid name-start character \'\t\'."');
shouldThrow("document.implementation.createDocumentType('foo:\t', null, null)", '"InvalidCharacterError: Failed to execute \'createDocumentType\' on \'DOMImplementation\': The qualified name provided (\'foo:\t\') contains the invalid name-start character \'\t\'."');
shouldThrow("document.implementation.createDocumentType('foo :bar', null, null)", '"InvalidCharacterError: Failed to execute \'createDocumentType\' on \'DOMImplementation\': The qualified name provided (\'foo :bar\') contains the invalid character \' \'."');
shouldThrow("document.implementation.createDocumentType('foo: bar', null, null)", '"InvalidCharacterError: Failed to execute \'createDocumentType\' on \'DOMImplementation\': The qualified name provided (\'foo: bar\') contains the invalid name-start character \' \'."');
shouldThrow("document.implementation.createDocumentType('a:b:c', null, null)", '"InvalidCharacterError: Failed to execute \'createDocumentType\' on \'DOMImplementation\': The qualified name provided (\'a:b:c\') contains multiple colons."');
</script>
</body>
</html>