summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2007-09-22 01:13:17 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2007-09-22 01:13:17 +0000
commit730aed4bbb3cc698b4b380c893bbb675d9014c10 (patch)
treedf8d6f97e588e855cf9de04ee6178e6f6546aef6 /src
parentabc473b7f36db0d3fb1ffdf6044f942f6ffb371f (diff)
downloadlibdom-730aed4bbb3cc698b4b380c893bbb675d9014c10.tar.gz
libdom-730aed4bbb3cc698b4b380c893bbb675d9014c10.tar.bz2
If new_child is already in the tree ensure its parent is not read only
svn path=/trunk/dom/; revision=3556
Diffstat (limited to 'src')
-rw-r--r--src/core/node.c9
1 files 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 */