Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

// META: title=Documents created by the parsing APIs inherit the creating document's origin
test(() => {
assert_not_equals(document.domain, "");
}, "This document has a tuple origin (prerequisite for the tests below)");
test(() => {
const doc = new DOMParser().parseFromString("", "text/html");
assert_equals(doc.domain, document.domain);
}, "DOMParser's parseFromString() with text/html");
test(() => {
const doc = new DOMParser().parseFromString("<x/>", "text/xml");
assert_equals(doc.domain, document.domain);
}, "DOMParser's parseFromString() with text/xml");
test(() => {
const doc = Document.parseHTML("");
assert_equals(doc.domain, document.domain);
}, "Document.parseHTML()");
test(() => {
const doc = Document.parseHTMLUnsafe("");
assert_equals(doc.domain, document.domain);
}, "Document.parseHTMLUnsafe()");
test(() => {
const doc = document.implementation.createDocument(null, "");
assert_equals(doc.domain, document.domain);
}, "createDocument()");
test(() => {
const doc = document.implementation.createHTMLDocument("");
assert_equals(doc.domain, document.domain);
}, "createHTMLDocument()");