mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
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:
parent
bf7c804588
commit
e50959a58e
3 changed files with 57 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue