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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/dom/nodes/Document-constructor-xml.xml

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

Powered by Google App Engine
This is Rietveld 408576698