summaryrefslogtreecommitdiff
path: root/src/core
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
commit74edf9308e38c0c7e61d10cc7e08555513281102 (patch)
treedf8d6f97e588e855cf9de04ee6178e6f6546aef6 /src/core
parent37ed23bfe658d1295b74dc7e24872b115586849c (diff)
downloadlibdom-74edf9308e38c0c7e61d10cc7e08555513281102.tar.gz
libdom-74edf9308e38c0c7e61d10cc7e08555513281102.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/core')
-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 */