diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 940baaca36f..425336fd669 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -2772,7 +2772,14 @@ impl DocumentMethods for Document { if self.is_html_document { local_name.make_ascii_lowercase(); } - let name = QualName::new(ns!(html), LocalName::from(local_name)); + + let ns = if self.is_html_document || self.content_type == "application/xhtml+xml" { + ns!(html) + } else { + ns!() + }; + + let name = QualName::new(ns, LocalName::from(local_name)); Ok(Element::create(name, None, self, ElementCreator::ScriptCreated)) } diff --git a/tests/wpt/metadata/dom/nodes/Document-constructor.html.ini b/tests/wpt/metadata/dom/nodes/Document-constructor.html.ini new file mode 100644 index 00000000000..95d61e5bf50 --- /dev/null +++ b/tests/wpt/metadata/dom/nodes/Document-constructor.html.ini @@ -0,0 +1,4 @@ +[Document-constructor.html] + type: testharness + [new Document(): URL parsing] + expected: FAIL diff --git a/tests/wpt/metadata/dom/nodes/Node-properties.html.ini b/tests/wpt/metadata/dom/nodes/Node-properties.html.ini deleted file mode 100644 index 2e1731cc21b..00000000000 --- a/tests/wpt/metadata/dom/nodes/Node-properties.html.ini +++ /dev/null @@ -1,8 +0,0 @@ -[Node-properties.html] - type: testharness - [xmlElement.namespaceURI] - expected: FAIL - - [detachedXmlElement.namespaceURI] - expected: FAIL - diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 2f69c026a5d..ee5039c9883 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -25451,7 +25451,7 @@ "testharness" ], "mozilla/document_head.html": [ - "31892b141aba3b317502e38a4a38fcd8531cb8aa", + "b861fe5a1159ba5fba44d3aee048cdb27d378be9", "testharness" ], "mozilla/document_images_cache.html": [ diff --git a/tests/wpt/mozilla/tests/mozilla/document_head.html b/tests/wpt/mozilla/tests/mozilla/document_head.html index f8666af0150..88e568b8644 100644 --- a/tests/wpt/mozilla/tests/mozilla/document_head.html +++ b/tests/wpt/mozilla/tests/mozilla/document_head.html @@ -13,8 +13,8 @@ test(function() { var new_document = new Document(); - new_document.appendChild(new_document.createElement("html")); - var new_head = new_document.createElement("head"); + new_document.appendChild(new_document.createElementNS('http://www.w3.org/1999/xhtml', "html")); + var new_head = new_document.createElementNS('http://www.w3.org/1999/xhtml', 'head'); assert_not_equals(new_head, null, "test2-0, append head to a new document"); assert_true(new_head instanceof HTMLHeadElement, "test2-1, append head to a new document: should be HTMLHeadElement"); @@ -30,9 +30,9 @@ test(function() { var new_document = new Document(); - var html = new_document.createElement("html"); - var foo = new_document.createElement("foo"); - var head = new_document.createElement("head"); + var html = new_document.createElementNS('http://www.w3.org/1999/xhtml', "html"); + var foo = new_document.createElementNS('http://www.w3.org/1999/xhtml', "foo"); + var head = new_document.createElementNS('http://www.w3.org/1999/xhtml', "head"); new_document.appendChild(html); html.appendChild(foo); foo.appendChild(head);