From a8ce3e3366f5a9e72e0b00bc55e4f9d88a4ebfee Mon Sep 17 00:00:00 2001 From: Zachary Newman Date: Mon, 17 Nov 2014 21:21:46 -0500 Subject: [PATCH] Update behavior of Document.createElement Fixes #4009. Only lower-case the argument to Document#createElement if it's a HTML document. --- components/script/dom/document.rs | 6 +++++- tests/wpt/metadata/dom/nodes/Document-constructor.html.ini | 3 --- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 2b8632fd7c1..7bdc519b242 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -567,7 +567,11 @@ impl<'a> DocumentMethods for JSRef<'a, Document> { debug!("Not a valid element name"); return Err(InvalidCharacter); } - let local_name = local_name.as_slice().to_ascii_lower(); + let local_name = if self.is_html_document { + local_name.as_slice().to_ascii_lower() + } else { + local_name + }; let name = QualName::new(ns!(HTML), Atom::from_slice(local_name.as_slice())); Ok(Element::create(name, None, self, ScriptCreated)) } diff --git a/tests/wpt/metadata/dom/nodes/Document-constructor.html.ini b/tests/wpt/metadata/dom/nodes/Document-constructor.html.ini index 35793e4ed5e..fe66c38792e 100644 --- a/tests/wpt/metadata/dom/nodes/Document-constructor.html.ini +++ b/tests/wpt/metadata/dom/nodes/Document-constructor.html.ini @@ -3,9 +3,6 @@ [new Document(): interfaces] expected: FAIL - [new Document(): metadata] - expected: FAIL - [new Document(): URL parsing] expected: FAIL