Fix appendChild() and insertBefore() (and replaceChild() indirectly) when

the node being added is a fragment node.
This closes SF bug #487929.
This commit is contained in:
Fred Drake 2001-12-06 04:32:18 +00:00
parent bf7c804588
commit e50959a58e
3 changed files with 57 additions and 2 deletions

View file

@ -132,7 +132,7 @@ class Node(xml.dom.Node):
def insertBefore(self, newChild, refChild):
if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE:
for c in newChild.childNodes:
for c in tuple(newChild.childNodes):
self.insertBefore(c, refChild)
### The DOM does not clearly specify what to return in this case
return newChild
@ -160,7 +160,7 @@ class Node(xml.dom.Node):
def appendChild(self, node):
if node.nodeType == self.DOCUMENT_FRAGMENT_NODE:
for c in node.childNodes:
for c in tuple(node.childNodes):
self.appendChild(c)
### The DOM does not clearly specify what to return in this case
return node