From 82ff32a71094898454a2b9f269b1a306d5afd4a8 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 30 Oct 2014 14:27:15 +0100 Subject: [PATCH] Pass the correct argument to Element::create when cloning. The current code calls as_slice() on the Option, yielding &[DOMString], and then calls to_string, yielding "[prefix]". --- components/script/dom/node.rs | 2 +- tests/wpt/metadata/dom/nodes/Element-tagName.html.ini | 6 ------ tests/wpt/metadata/dom/nodes/Node-cloneNode.html.ini | 6 ------ 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 938404bdc37..c1b3ffc7980 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -1516,7 +1516,7 @@ impl Node { local: element.local_name().clone() }; let element = Element::create(name, - Some(element.prefix().as_slice().to_string()), *document, ScriptCreated); + element.prefix().as_ref().map(|p| p.as_slice().to_string()), *document, ScriptCreated); NodeCast::from_temporary(element) }, TextNodeTypeId => { diff --git a/tests/wpt/metadata/dom/nodes/Element-tagName.html.ini b/tests/wpt/metadata/dom/nodes/Element-tagName.html.ini index 70f532bf2ee..f9cc02a4f31 100644 --- a/tests/wpt/metadata/dom/nodes/Element-tagName.html.ini +++ b/tests/wpt/metadata/dom/nodes/Element-tagName.html.ini @@ -3,9 +3,3 @@ [tagName should be updated when changing ownerDocument] expected: FAIL - [tagName should be updated when changing ownerDocument (createDocument without prefix)] - expected: FAIL - - [tagName should be updated when changing ownerDocument (createDocument with prefix)] - expected: FAIL - diff --git a/tests/wpt/metadata/dom/nodes/Node-cloneNode.html.ini b/tests/wpt/metadata/dom/nodes/Node-cloneNode.html.ini index 015721fb33b..e8a25099d6e 100644 --- a/tests/wpt/metadata/dom/nodes/Node-cloneNode.html.ini +++ b/tests/wpt/metadata/dom/nodes/Node-cloneNode.html.ini @@ -1,11 +1,5 @@ [Node-cloneNode.html] type: testharness - [Unprefixed HTML element] - expected: FAIL - - [Prefixed HTML element] - expected: FAIL - [Prefixed non-HTML element] expected: FAIL