cvs: php4 /ext/domxml php_domxml.c
| From: | Christian Stocker | Date: | Wed, 14 Aug 2002 17:38:21 +0000 |
| Subject: | cvs: php4 /ext/domxml php_domxml.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-13365@lists.php.net to get a copy of this message | ||
chregu Wed Aug 14 13:38:21 2002 EDT
Modified files:
/php4/ext/domxml php_domxml.c
Log:
- 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...
Index: php4/ext/domxml/php_domxml.c
diff -u php4/ext/domxml/php_domxml.c:1.191 php4/ext/domxml/php_domxml.c:1.192
--- php4/ext/domxml/php_domxml.c:1.191 Wed Aug 14 12:53:56 2002
+++ php4/ext/domxml/php_domxml.c Wed Aug 14 13:38:20 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_domxml.c,v 1.191 2002/08/14 16:53:56 chregu Exp $ */
+/* $Id: php_domxml.c,v 1.192 2002/08/14 17:38:20 chregu Exp $ */
/* TODO
* - Support Notation Nodes
@@ -2512,28 +2512,16 @@
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;