Commit 19aff0c9 authored by Andrew M. Kuchling's avatar Andrew M. Kuchling

#1433694: minidom's .normalize() failed to set .nextSibling for last element.

Fix by Malte Helmert
parent 8887e548
...@@ -791,6 +791,14 @@ class MinidomTest(unittest.TestCase): ...@@ -791,6 +791,14 @@ class MinidomTest(unittest.TestCase):
"testNormalize -- single empty node removed") "testNormalize -- single empty node removed")
doc.unlink() doc.unlink()
def testBug1433694(self):
doc = parseString("<o><i/>t</o>")
node = doc.documentElement
node.childNodes[1].nodeValue = ""
node.normalize()
self.confirm(node.childNodes[-1].nextSibling == None,
"Final child's .nextSibling should be None")
def testSiblings(self): def testSiblings(self):
doc = parseString("<doc><?pi?>text?<elm/></doc>") doc = parseString("<doc><?pi?>text?<elm/></doc>")
root = doc.documentElement root = doc.documentElement
......
...@@ -203,6 +203,8 @@ class Node(xml.dom.Node): ...@@ -203,6 +203,8 @@ class Node(xml.dom.Node):
L.append(child) L.append(child)
if child.nodeType == Node.ELEMENT_NODE: if child.nodeType == Node.ELEMENT_NODE:
child.normalize() child.normalize()
if L:
L[-1].nextSibling = None
self.childNodes[:] = L self.childNodes[:] = L
def cloneNode(self, deep): def cloneNode(self, deep):
......
...@@ -274,6 +274,7 @@ Shane Hathaway ...@@ -274,6 +274,7 @@ Shane Hathaway
Rycharde Hawkes Rycharde Hawkes
Jochen Hayek Jochen Hayek
Thomas Heller Thomas Heller
Malte Helmert
Lance Finn Helsten Lance Finn Helsten
Jonathan Hendry Jonathan Hendry
James Henstridge James Henstridge
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment