From 859f14f38be753d20b7cf926af81e26dc22d3a31 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 16 Nov 2014 12:38:46 +0100 Subject: [PATCH] Correct the checks in step 5 of Node::pre_insert. --- components/script/dom/node.rs | 14 ++++++-------- .../metadata/dom/nodes/Node-insertBefore.html.ini | 11 ----------- 2 files changed, 6 insertions(+), 19 deletions(-) delete mode 100644 tests/wpt/metadata/dom/nodes/Node-insertBefore.html.ini diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 4c7d24f8f4f..0242363dbf7 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -1216,17 +1216,15 @@ impl Node { // Step 4-5. match node.type_id() { TextNodeTypeId => { - match node.parent_node().root() { - Some(ref parent) if parent.is_document() => return Err(HierarchyRequest), - _ => () + if parent.is_document() { + return Err(HierarchyRequest); } - } + }, DoctypeNodeTypeId => { - match node.parent_node().root() { - Some(ref parent) if !parent.is_document() => return Err(HierarchyRequest), - _ => () + if !parent.is_document() { + return Err(HierarchyRequest); } - } + }, DocumentFragmentNodeTypeId | ElementNodeTypeId(_) | ProcessingInstructionNodeTypeId | diff --git a/tests/wpt/metadata/dom/nodes/Node-insertBefore.html.ini b/tests/wpt/metadata/dom/nodes/Node-insertBefore.html.ini deleted file mode 100644 index fa7f987c0dc..00000000000 --- a/tests/wpt/metadata/dom/nodes/Node-insertBefore.html.ini +++ /dev/null @@ -1,11 +0,0 @@ -[Node-insertBefore.html] - type: testharness - [If the context node is a document, inserting a document or text node should throw a HierarchyRequestError.] - expected: FAIL - - [If the context node is a DocumentFragment, inserting a document or a doctype should throw a HierarchyRequestError.] - expected: FAIL - - [If the context node is an element, inserting a document or a doctype should throw a HierarchyRequestError.] - expected: FAIL -