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

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

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 <svg xmlns="http://www.w3.org/2000/svg" xmlns:html="http://www.w3.org/1999/xhtml "
5 width="100%" height="100%" viewBox="0 0 800 600">
5 <title>Document constructor</title> 6 <title>Document constructor</title>
6 <link rel=help href="https://dom.spec.whatwg.org/#dom-document"> 7 <html:script src="/resources/testharness.js"></html:script>
7 <script src="/resources/testharness.js"></script> 8 <html:script src="/resources/testharnessreport.js"></html:script>
8 <script src="/resources/testharnessreport.js"></script> 9 <html:script><![CDATA[
9 <div id="log"></div>
10 <script>
11 test(function() { 10 test(function() {
12 var doc = new Document(); 11 var doc = new Document();
13 assert_true(doc instanceof Node, "Should be a Node"); 12 assert_true(doc instanceof Node, "Should be a Node");
14 assert_true(doc instanceof Document, "Should be a Document"); 13 assert_true(doc instanceof Document, "Should be a Document");
15 assert_false(doc instanceof XMLDocument, "Should not be an XMLDocument"); 14 assert_false(doc instanceof XMLDocument, "Should not be an XMLDocument");
16 assert_equals(Object.getPrototypeOf(doc), Document.prototype, 15 assert_equals(Object.getPrototypeOf(doc), Document.prototype,
17 "Document should be the primary interface"); 16 "Document should be the primary interface");
18 }, "new Document(): interfaces") 17 }, "new Document(): interfaces")
19 18
20 test(function() { 19 test(function() {
21 var doc = new Document(); 20 var doc = new Document();
22 assert_equals(doc.firstChild, null, "firstChild"); 21 assert_equals(doc.firstChild, null, "firstChild");
23 assert_equals(doc.lastChild, null, "lastChild"); 22 assert_equals(doc.lastChild, null, "lastChild");
24 assert_equals(doc.doctype, null, "doctype"); 23 assert_equals(doc.doctype, null, "doctype");
25 assert_equals(doc.documentElement, null, "documentElement"); 24 assert_equals(doc.documentElement, null, "documentElement");
26 assert_array_equals(doc.childNodes, [], "childNodes"); 25 assert_array_equals(doc.childNodes, [], "childNodes");
27 }, "new Document(): children") 26 }, "new Document(): children")
28 27
29 test(function() { 28 test(function() {
30 var doc = new Document(); 29 var doc = new Document();
31 assert_equals(doc.URL, "about:blank"); 30 assert_equals(doc.URL, "about:blank");
32 assert_equals(doc.documentURI, "about:blank"); 31 assert_equals(doc.documentURI, "about:blank");
33 assert_equals(doc.compatMode, "CSS1Compat"); 32 assert_equals(doc.compatMode, "CSS1Compat");
34 assert_equals(doc.characterSet, "UTF-8"); 33 assert_equals(doc.characterSet, "UTF-8");
35 assert_equals(doc.contentType, "application/xml"); 34 assert_equals(doc.contentType, "application/xml");
35 assert_equals(doc.origin, document.origin);
36 assert_equals(doc.createElement("DIV").localName, "DIV"); 36 assert_equals(doc.createElement("DIV").localName, "DIV");
37 }, "new Document(): metadata") 37 }, "new Document(): metadata")
38 38
39 test(function() { 39 test(function() {
40 var doc = new Document(); 40 var doc = new Document();
41 assert_equals(doc.characterSet, "UTF-8", "characterSet"); 41 assert_equals(doc.characterSet, "UTF-8", "characterSet");
42 assert_equals(doc.charset, "UTF-8", "charset"); 42 assert_equals(doc.charset, "UTF-8", "charset");
43 assert_equals(doc.inputEncoding, "UTF-8", "inputEncoding"); 43 assert_equals(doc.inputEncoding, "UTF-8", "inputEncoding");
44 }, "new Document(): characterSet aliases") 44 }, "new Document(): characterSet aliases")
45 ]]></html:script>
46 </svg>
45 47
46 test(function() {
47 var doc = new Document();
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