diff options
Diffstat (limited to 'src/core/node.c')
-rw-r--r-- | src/core/node.c | 9 |
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 */ |