From 5c935cb372c55f1a1eaf1672cf3523f777b6de1a Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Wed, 14 Aug 2002 17:38:20 +0000 Subject: - let DomNode->replace_child always behave correctly (acc. to W3C specs) if the newchild had the same parent as the old child, nothing happened, which seemed strange behaviout to me... --- ext/domxml/php_domxml.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'ext/domxml/php_domxml.c') diff --git a/ext/domxml/php_domxml.c b/ext/domxml/php_domxml.c index 039c95648d..c656a1afd5 100644 --- a/ext/domxml/php_domxml.c +++ b/ext/domxml/php_domxml.c @@ -2512,29 +2512,17 @@ PHP_FUNCTION(domxml_node_replace_child) if (children == oldchild) { foundoldchild = 1; } - if(children == newchild) { - foundnewchild = 1; - } children = children->next; } /* if the child to replace is existent and the new child isn't already * a child, then do the replacement */ - if(foundoldchild && !foundnewchild) { + if(foundoldchild ) { zval *rv = NULL; xmlNodePtr node; node = xmlReplaceNode(oldchild, newchild); DOMXML_RET_OBJ(rv, oldchild, &ret); return; - } - /* If the new child is already a child, then DOM requires to delete - * the old one first, but this makes no sense here, since the old and - * the new node are identical. - */ - if(foundnewchild) { - zval *rv = NULL; - DOMXML_RET_OBJ(rv, newchild, &ret); - return; } else { RETURN_FALSE; } -- cgit v1.2.1