OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
3 <title>DOMImplementation.createDocument(namespace, qualifiedName, doctype)</titl
e> | 3 <title>DOMImplementation.createDocument(namespace, qualifiedName, doctype)</titl
e> |
4 <link rel=help href="https://dom.spec.whatwg.org/#dom-domimplementation-createdo
cument"> | 4 <link rel=help href="https://dom.spec.whatwg.org/#dom-domimplementation-createdo
cument"> |
5 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-createelementns"> | 5 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-createelementns"> |
6 <link rel=help href="https://dom.spec.whatwg.org/#dom-node-nodetype"> | 6 <link rel=help href="https://dom.spec.whatwg.org/#dom-node-nodetype"> |
7 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-documentelement"> | 7 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-documentelement"> |
8 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-doctype"> | 8 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-doctype"> |
9 <script src="../../../../resources/testharness.js"></script> | 9 <script src="../../../../resources/testharness.js"></script> |
10 <script src="../../../../resources/testharnessreport.js"></script> | 10 <script src="../../../../resources/testharnessreport.js"></script> |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 116 } |
117 assert_equals(doc.childNodes.length, !omitRootElement + !!doctype) | 117 assert_equals(doc.childNodes.length, !omitRootElement + !!doctype) |
118 } | 118 } |
119 }, "createDocument test " + i + ": " + t.map(function(el) { return format_va
lue(el) })) | 119 }, "createDocument test " + i + ": " + t.map(function(el) { return format_va
lue(el) })) |
120 | 120 |
121 if (expected === null) { | 121 if (expected === null) { |
122 test(function() { | 122 test(function() { |
123 var doc = document.implementation.createDocument(namespace, qualifiedNam
e, doctype) | 123 var doc = document.implementation.createDocument(namespace, qualifiedNam
e, doctype) |
124 assert_equals(doc.compatMode, "CSS1Compat") | 124 assert_equals(doc.compatMode, "CSS1Compat") |
125 assert_equals(doc.characterSet, "UTF-8") | 125 assert_equals(doc.characterSet, "UTF-8") |
126 assert_equals(doc.contentType, namespace == htmlNamespace ? "text/html" | 126 assert_equals(doc.contentType, namespace == htmlNamespace ? "application
/xhtml+xml" |
127 : namespace == svgNamespace ? "image/svg+xml" | 127 : namespace == svgNamespace ? "image/svg+xml" |
128 : "application/xml") | 128 : "application/xml") |
129 assert_equals(doc.URL, "about:blank") | 129 assert_equals(doc.URL, "about:blank") |
130 assert_equals(doc.documentURI, "about:blank") | 130 assert_equals(doc.documentURI, "about:blank") |
131 assert_equals(doc.createElement("DIV").localName, "DIV"); | 131 assert_equals(doc.createElement("DIV").localName, "DIV"); |
132 }, "createDocument test " + i + ": metadata for " + | 132 }, "createDocument test " + i + ": metadata for " + |
133 [namespace, qualifiedName, doctype].map(function(el) { return format_value
(el) })) | 133 [namespace, qualifiedName, doctype].map(function(el) { return format_value
(el) })) |
134 | 134 |
135 test(function() { | 135 test(function() { |
136 var doc = document.implementation.createDocument(namespace, qualifiedNam
e, doctype) | 136 var doc = document.implementation.createDocument(namespace, qualifiedNam
e, doctype) |
137 assert_equals(doc.characterSet, "UTF-8", "characterSet"); | 137 assert_equals(doc.characterSet, "UTF-8", "characterSet"); |
138 assert_equals(doc.charset, "UTF-8", "charset"); | 138 assert_equals(doc.charset, "UTF-8", "charset"); |
139 assert_equals(doc.inputEncoding, "UTF-8", "inputEncoding"); | 139 assert_equals(doc.inputEncoding, "UTF-8", "inputEncoding"); |
140 }, "createDocument test " + i + ": characterSet aliases for " + | 140 }, "createDocument test " + i + ": characterSet aliases for " + |
141 [namespace, qualifiedName, doctype].map(function(el) { return format_value
(el) })) | 141 [namespace, qualifiedName, doctype].map(function(el) { return format_value
(el) })) |
142 } | 142 } |
143 }) | 143 }) |
144 }) | 144 }) |
145 | 145 |
146 test(function() { | 146 test(function() { |
147 assert_throws(new TypeError(), function() { | 147 assert_throws(new TypeError(), function() { |
148 document.implementation.createDocument() | 148 document.implementation.createDocument() |
149 }, "createDocument() should throw") | 149 }, "createDocument() should throw") |
150 | 150 |
151 assert_throws(new TypeError(), function() { | 151 assert_throws(new TypeError(), function() { |
152 document.implementation.createDocument('') | 152 document.implementation.createDocument('') |
153 }, "createDocument('') should throw") | 153 }, "createDocument('') should throw") |
154 }, "createDocument with missing arguments"); | 154 }, "createDocument with missing arguments"); |
155 </script> | 155 </script> |
OLD | NEW |