Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(638)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/DOMImplementation-createHTMLDocument.html

Issue 1529523002: Import dom/ from web-platform-tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak W3CImportExpectations Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta charset=windows-1252>
3 <!-- Using windows-1252 to ensure that DOMImplementation.createHTMLDocument()
4 doesn't inherit utf-8 from the parent document. -->
5 <title>DOMImplementation.createHTMLDocument</title>
6 <link rel=help href="https://dom.spec.whatwg.org/#dom-domimplementation-createht mldocument">
7 <link rel=help href="https://dom.spec.whatwg.org/#dom-documenttype-name">
8 <link rel=help href="https://dom.spec.whatwg.org/#dom-documenttype-publicid">
9 <link rel=help href="https://dom.spec.whatwg.org/#dom-documenttype-systemid">
10 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-documentelement">
11 <script src="../../../../resources/testharness.js"></script>
12 <script src="../../../../resources/testharnessreport.js"></script>
13 <script src="DOMImplementation-createHTMLDocument.js"></script>
14 <div id="log"></div>
15 <script>
16 createHTMLDocuments(function(doc, expectedtitle, normalizedtitle) {
17 assert_true(doc instanceof Document, "Should be a Document")
18 assert_true(doc instanceof Node, "Should be a Node")
19 assert_equals(doc.childNodes.length, 2,
20 "Document should have two child nodes")
21
22 var doctype = doc.doctype
23 assert_true(doctype instanceof DocumentType,
24 "Doctype should be a DocumentType")
25 assert_true(doctype instanceof Node, "Doctype should be a Node")
26 assert_equals(doctype.name, "html")
27 assert_equals(doctype.publicId, "")
28 assert_equals(doctype.systemId, "")
29
30 var documentElement = doc.documentElement
31 assert_true(documentElement instanceof HTMLHtmlElement,
32 "Document element should be a HTMLHtmlElement")
33 assert_equals(documentElement.childNodes.length, 2,
34 "Document element should have two child nodes")
35 assert_equals(documentElement.localName, "html")
36 assert_equals(documentElement.tagName, "HTML")
37
38 var head = documentElement.firstChild
39 assert_true(head instanceof HTMLHeadElement,
40 "Head should be a HTMLHeadElement")
41 assert_equals(head.localName, "head")
42 assert_equals(head.tagName, "HEAD")
43
44 if (expectedtitle !== undefined) {
45 assert_equals(head.childNodes.length, 1)
46
47 var title = head.firstChild
48 assert_true(title instanceof HTMLTitleElement,
49 "Title should be a HTMLTitleElement")
50 assert_equals(title.localName, "title")
51 assert_equals(title.tagName, "TITLE")
52 assert_equals(title.childNodes.length, 1)
53 assert_equals(title.firstChild.data, expectedtitle)
54 } else {
55 assert_equals(head.childNodes.length, 0)
56 }
57
58 var body = documentElement.lastChild
59 assert_true(body instanceof HTMLBodyElement,
60 "Body should be a HTMLBodyElement")
61 assert_equals(body.localName, "body")
62 assert_equals(body.tagName, "BODY")
63 assert_equals(body.childNodes.length, 0)
64 })
65
66 test(function() {
67 var doc = document.implementation.createHTMLDocument("test");
68 assert_equals(doc.URL, "about:blank");
69 assert_equals(doc.documentURI, "about:blank");
70 assert_equals(doc.compatMode, "CSS1Compat");
71 assert_equals(doc.characterSet, "UTF-8");
72 assert_equals(doc.contentType, "text/html");
73 assert_equals(doc.createElement("DIV").localName, "div");
74 }, "createHTMLDocument(): metadata")
75
76 test(function() {
77 var doc = document.implementation.createHTMLDocument("test");
78 assert_equals(doc.characterSet, "UTF-8", "characterSet");
79 assert_equals(doc.charset, "UTF-8", "charset");
80 assert_equals(doc.inputEncoding, "UTF-8", "inputEncoding");
81 }, "createHTMLDocument(): characterSet aliases")
82
83 test(function() {
84 var doc = document.implementation.createHTMLDocument("test");
85 var a = doc.createElement("a");
86 // In UTF-8: 0xC3 0xA4
87 a.href = "http://example.org/?\u00E4";
88 assert_equals(a.href, "http://example.org/?%C3%A4");
89 }, "createHTMLDocument(): URL parsing")
90 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698