[4suite] Bug in Node.replaceChild()

Mike Olson Mike.Olson at fourthought.com
Wed Sep 6 10:32:46 MDT 2000


Alexandre Fayolle wrote:

Thanks again, I've fixed this as well.

Mike
> 
> When a node is used to replace another node using
> parent.replaceChild(newnode,oldnode), the new node is not removed from the
> list of it's former parent children.
> 
> Here is a fix for this bug:
> 
> in file Node.py, method replaceChild:
> 
>             if index == -1:
>                 raise DOMException(NOT_FOUND_ERR)
> 
>             self.__dict__['__childNodes'][index] = newChild
> +++         #Remove from old parent
> +++         if newChild.parentNode != None:
> +++             newChild.parentNode.removeChild(newChild);
> 
>             newChild._4dom_setNextSibling(oldChild.nextSibling)
>             newChild._4dom_setPreviousSibling(oldChild.previousSibling)
> 
> --
> Alexandre Fayolle
> Logilab
> 
> _______________________________________________
> 4suite mailing list
> 4suite at lists.fourthought.com
> http://lists.fourthought.com/mailman/listinfo/4suite

-- 
Mike Olson				 Principal Consultant
mike.olson at fourthought.com               (303)583-9900 x 102
Fourthought, Inc.                         http://Fourthought.com 
Software-engineering, knowledge-management, XML, CORBA, Linux, Python



More information about the 4suite mailing list