- fix for bug #17771 (insert_before misbeaviour (DOM L2 spec.))

@ - DomNode->insert_before behaves now according to W3C spec
@   ie. new_child is moved, not copied. (chregu)
This commit is contained in:
Christian Stocker 2002-08-14 16:12:18 +00:00
parent 9f597d2dd1
commit c0a79401fd

View File

@ -2453,19 +2453,14 @@ PHP_FUNCTION(domxml_node_insert_before)
DOMXML_GET_OBJ(child, node, le_domxmlnodep);
DOMXML_GET_OBJ(refp, ref, le_domxmlnodep);
if (NULL == (new_child = xmlCopyNode(child, 1))) {
php_error(E_WARNING, "%s(): unable to clone node", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
new_child = xmlAddPrevSibling(refp, child);
child = xmlAddPrevSibling(refp, new_child);
if (NULL == child) {
if (NULL == new_child) {
php_error(E_WARNING, "%s(): couldn't add newnode as the previous sibling of refnode", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
DOMXML_RET_OBJ(rv, child, &ret);
DOMXML_RET_OBJ(rv, new_child, &ret);
}
/* }}} */