Does replaceChild()
break for
loop around childNodes
in Python minidom?
Consider the following code with v
being a minidom node:
for w in v.childNodes:
if ...:
frag = parseString(...)
v.replaceChild(w, frag.documentElement)
Will it work as expected enumerating all child nodes in turn? Or will replaceChild
break the for
loop?
https://www.w3.org/TR/DOM-Level-1/level-one-core.html says:
The content of the returned NodeList is "live" in the sense that, for instance, changes to the children of the node object that it was created from are immediately reflected in the nodes returned by the NodeList accessors; it is not a static snapshot of the content of the node.
This follows that the loop won't be broken.