[4suite] Bug in Node.replaceChild()

Alexandre Fayolle alf at logilab.com
Mon Sep 4 09:24:16 MDT 2000


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




More information about the 4suite mailing list