From 730aed4bbb3cc698b4b380c893bbb675d9014c10 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 22 Sep 2007 01:13:17 +0000 Subject: If new_child is already in the tree ensure its parent is not read only svn path=/trunk/dom/; revision=3556 --- src/core/node.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/node.c b/src/core/node.c index 8137a9c..d570a72 100644 --- a/src/core/node.c +++ b/src/core/node.c @@ -638,9 +638,14 @@ dom_exception dom_node_insert_before(struct dom_node *node, return DOM_NO_ERR; } - /* If new_child is already in the tree, remove it */ - if (new_child->parent != NULL) + /* If new_child is already in the tree and + * its parent isn't read only, remove it */ + if (new_child->parent != NULL) { + if (_dom_node_readonly(new_child->parent)) + return DOM_NO_MODIFICATION_ALLOWED_ERR; + _dom_node_detach(new_child); + } /* If new_child is a DocumentFragment, insert its children * Otherwise, insert new_child */ -- cgit v1.2.3