Fix appendChild() and insertBefore() (and replaceChild() indirectly) when
the node being added is a fragment node.
This closes SF bug #487929.
diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py
index 5b26da7..2e9d866 100644
--- a/Lib/xml/dom/minidom.py
+++ b/Lib/xml/dom/minidom.py
@@ -132,7 +132,7 @@
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 @@
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