Document-constructor-xml.xml (1864B)
1 <?xml version="1.0" encoding="windows-1252"?> 2 <!-- Using windows-1252 to ensure that new Document() doesn't inherit utf-8 3 from the parent document. --> 4 <html xmlns="http://www.w3.org/1999/xhtml"> 5 <head> 6 <title>Document constructor</title> 7 <link rel="help" href="https://dom.spec.whatwg.org/#dom-document" /> 8 </head> 9 <body> 10 <script src="/resources/testharness.js"></script> 11 <script src="/resources/testharnessreport.js"></script> 12 <script><![CDATA[ 13 test(function() { 14 var doc = new Document(); 15 assert_true(doc instanceof Node, "Should be a Node"); 16 assert_true(doc instanceof Document, "Should be a Document"); 17 assert_false(doc instanceof XMLDocument, "Should not be an XMLDocument"); 18 assert_equals(Object.getPrototypeOf(doc), Document.prototype, 19 "Document should be the primary interface"); 20 }, "new Document(): interfaces") 21 22 test(function() { 23 var doc = new Document(); 24 assert_equals(doc.firstChild, null, "firstChild"); 25 assert_equals(doc.lastChild, null, "lastChild"); 26 assert_equals(doc.doctype, null, "doctype"); 27 assert_equals(doc.documentElement, null, "documentElement"); 28 assert_array_equals(doc.childNodes, [], "childNodes"); 29 }, "new Document(): children") 30 31 test(function() { 32 var doc = new Document(); 33 assert_equals(doc.URL, "about:blank"); 34 assert_equals(doc.documentURI, "about:blank"); 35 assert_equals(doc.compatMode, "CSS1Compat"); 36 assert_equals(doc.characterSet, "UTF-8"); 37 assert_equals(doc.contentType, "application/xml"); 38 assert_equals(doc.createElement("DIV").localName, "DIV"); 39 }, "new Document(): metadata") 40 41 test(function() { 42 var doc = new Document(); 43 assert_equals(doc.characterSet, "UTF-8", "characterSet"); 44 assert_equals(doc.charset, "UTF-8", "charset"); 45 assert_equals(doc.inputEncoding, "UTF-8", "inputEncoding"); 46 }, "new Document(): characterSet aliases") 47 ]]></script> 48 </body> 49 </html>