diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/dom/nodes/DOMImplementation-createHTMLDocument.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/dom/nodes/DOMImplementation-createHTMLDocument.html')
-rw-r--r-- | testing/web-platform/tests/dom/nodes/DOMImplementation-createHTMLDocument.html | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/testing/web-platform/tests/dom/nodes/DOMImplementation-createHTMLDocument.html b/testing/web-platform/tests/dom/nodes/DOMImplementation-createHTMLDocument.html new file mode 100644 index 000000000..57f475c9c --- /dev/null +++ b/testing/web-platform/tests/dom/nodes/DOMImplementation-createHTMLDocument.html @@ -0,0 +1,90 @@ +<!DOCTYPE html> +<meta charset=windows-1252> +<!-- Using windows-1252 to ensure that DOMImplementation.createHTMLDocument() + doesn't inherit utf-8 from the parent document. --> +<title>DOMImplementation.createHTMLDocument</title> +<link rel=help href="https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument"> +<link rel=help href="https://dom.spec.whatwg.org/#dom-documenttype-name"> +<link rel=help href="https://dom.spec.whatwg.org/#dom-documenttype-publicid"> +<link rel=help href="https://dom.spec.whatwg.org/#dom-documenttype-systemid"> +<link rel=help href="https://dom.spec.whatwg.org/#dom-document-documentelement"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="DOMImplementation-createHTMLDocument.js"></script> +<div id="log"></div> +<script> +createHTMLDocuments(function(doc, expectedtitle, normalizedtitle) { + assert_true(doc instanceof Document, "Should be a Document") + assert_true(doc instanceof Node, "Should be a Node") + assert_equals(doc.childNodes.length, 2, + "Document should have two child nodes") + + var doctype = doc.doctype + assert_true(doctype instanceof DocumentType, + "Doctype should be a DocumentType") + assert_true(doctype instanceof Node, "Doctype should be a Node") + assert_equals(doctype.name, "html") + assert_equals(doctype.publicId, "") + assert_equals(doctype.systemId, "") + + var documentElement = doc.documentElement + assert_true(documentElement instanceof HTMLHtmlElement, + "Document element should be a HTMLHtmlElement") + assert_equals(documentElement.childNodes.length, 2, + "Document element should have two child nodes") + assert_equals(documentElement.localName, "html") + assert_equals(documentElement.tagName, "HTML") + + var head = documentElement.firstChild + assert_true(head instanceof HTMLHeadElement, + "Head should be a HTMLHeadElement") + assert_equals(head.localName, "head") + assert_equals(head.tagName, "HEAD") + + if (expectedtitle !== undefined) { + assert_equals(head.childNodes.length, 1) + + var title = head.firstChild + assert_true(title instanceof HTMLTitleElement, + "Title should be a HTMLTitleElement") + assert_equals(title.localName, "title") + assert_equals(title.tagName, "TITLE") + assert_equals(title.childNodes.length, 1) + assert_equals(title.firstChild.data, expectedtitle) + } else { + assert_equals(head.childNodes.length, 0) + } + + var body = documentElement.lastChild + assert_true(body instanceof HTMLBodyElement, + "Body should be a HTMLBodyElement") + assert_equals(body.localName, "body") + assert_equals(body.tagName, "BODY") + assert_equals(body.childNodes.length, 0) +}) + +test(function() { + var doc = document.implementation.createHTMLDocument("test"); + assert_equals(doc.URL, "about:blank"); + assert_equals(doc.documentURI, "about:blank"); + assert_equals(doc.compatMode, "CSS1Compat"); + assert_equals(doc.characterSet, "UTF-8"); + assert_equals(doc.contentType, "text/html"); + assert_equals(doc.createElement("DIV").localName, "div"); +}, "createHTMLDocument(): metadata") + +test(function() { + var doc = document.implementation.createHTMLDocument("test"); + assert_equals(doc.characterSet, "UTF-8", "characterSet"); + assert_equals(doc.charset, "UTF-8", "charset"); + assert_equals(doc.inputEncoding, "UTF-8", "inputEncoding"); +}, "createHTMLDocument(): characterSet aliases") + +test(function() { + var doc = document.implementation.createHTMLDocument("test"); + var a = doc.createElement("a"); + // In UTF-8: 0xC3 0xA4 + a.href = "http://example.org/?\u00E4"; + assert_equals(a.href, "http://example.org/?%C3%A4"); +}, "createHTMLDocument(): URL parsing") +</script> |