| Index: LayoutTests/fast/dom/implementation-api-args.html
|
| diff --git a/LayoutTests/fast/dom/implementation-api-args.html b/LayoutTests/fast/dom/implementation-api-args.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5bb21673cd73730639c6c339179c2fd69010d91b
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/dom/implementation-api-args.html
|
| @@ -0,0 +1,74 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| +<link rel="help" href="http://www.w3.org/TR/2012/WD-dom-20121206/#interface-domimplementation">
|
| +<script src="../js/resources/js-test-pre.js"></script>
|
| +</head>
|
| +<body>
|
| +<script>
|
| +description("Checks that the DOMImplementation api arguments are correctly validated")
|
| +
|
| +var testDocument, testPrototype, testNamespace, testQualifiedName, testDocType;
|
| +function validateDocument(document, prototype, namespace, qualifiedName, docType)
|
| +{
|
| + testDocument = document;
|
| + testPrototype = prototype;
|
| + testNamespace = namespace;
|
| + testQualifiedName = qualifiedName;
|
| + testDocType = docType;
|
| +
|
| + shouldBe('testDocument.__proto__', 'window["' + prototype + '"].prototype');
|
| + if (!testQualifiedName || testQualifiedName == "") {
|
| + shouldBeNull('testDocument.documentElement');
|
| + } else {
|
| + shouldBeEqualToString('testDocument.documentElement.tagName', '' + qualifiedName);
|
| + if (namespace)
|
| + shouldBeEqualToString('testDocument.documentElement.namespaceURI', '' + namespace);
|
| + else
|
| + shouldBeNull('testDocument.documentElement.namespaceURI');
|
| + }
|
| +
|
| + if (docType)
|
| + shouldBe('testDocument.doctype', 'testDocType');
|
| + else
|
| + shouldBeNull('testDocument.doctype');
|
| +}
|
| +
|
| +debug('\nDocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId);');
|
| +shouldThrow('document.implementation.createDocumentType()', "'TypeError: Not enough arguments'");
|
| +shouldThrow('document.implementation.createDocumentType("qualifiedName")', "'TypeError: Not enough arguments'");
|
| +shouldThrow('document.implementation.createDocumentType("qualifiedName", "publicId")', "'TypeError: Not enough arguments'");
|
| +var docType;
|
| +shouldNotThrow('docType = document.implementation.createDocumentType("qualifiedName", "publicId", "systemId")');
|
| +shouldBe('docType.__proto__', 'DocumentType.prototype');
|
| +shouldBeEqualToString('docType.name', 'qualifiedName');
|
| +shouldBeEqualToString('docType.publicId', 'publicId');
|
| +shouldBeEqualToString('docType.systemId', 'systemId');
|
| +
|
| +debug('\nXMLDocument createDocument(DOMString? namespace, [TreatNullAs=EmptyString] DOMString qualifiedName, DocumentType? doctype);');
|
| +shouldThrow('document.implementation.createDocument()', "'TypeError: Not enough arguments'");
|
| +shouldThrow('document.implementation.createDocument("namespace")', "'TypeError: Not enough arguments'");
|
| +shouldNotThrow('document.implementation.createDocument("namespace", "qualifiedName")');
|
| +var doc;
|
| +shouldNotThrow('doc = document.implementation.createDocument("namespace", "qualifiedName", null)');
|
| +validateDocument(doc, 'XMLDocument', 'namespace', 'qualifiedName', null);
|
| +shouldNotThrow('doc = document.implementation.createDocument(null, "qualifiedName", null)');
|
| +validateDocument(doc, 'XMLDocument', null, 'qualifiedName', null);
|
| +shouldNotThrow('doc = document.implementation.createDocument("", null, null)')
|
| +validateDocument(doc, 'XMLDocument', "", null, null);
|
| +shouldNotThrow('doc = document.implementation.createDocument("", "", null)')
|
| +validateDocument(doc, 'XMLDocument', "", "", null);
|
| +shouldNotThrow('doc = document.implementation.createDocument("namespace", "qualifiedName")');
|
| +validateDocument(doc, 'XMLDocument', "namespace", "qualifiedName", null);
|
| +shouldNotThrow('doc = document.implementation.createDocument("namespace", "qualifiedName", docType)');
|
| +validateDocument(doc, 'XMLDocument', "namespace", "qualifiedName", docType);
|
| +
|
| +debug('\nDocument createHTMLDocument(optional DOMString title);');
|
| +shouldNotThrow('doc = document.implementation.createHTMLDocument()');
|
| +validateDocument(doc, 'HTMLDocument', "http://www.w3.org/1999/xhtml", "HTML", doc.doctype);
|
| +shouldNotThrow('doc = document.implementation.createHTMLDocument("title")');
|
| +validateDocument(doc, 'HTMLDocument', "http://www.w3.org/1999/xhtml", "HTML", doc.doctype);
|
| +</script>
|
| +<script src="../js/resources/js-test-post.js"></script>
|
| +</body>
|
| +</html>
|
|
|