Skip to content

Commit 5bfa058

Browse files
arikrupnikfreddrake
authored andcommitted
bpo-33274: Compliance with DOM L1: return removed attribute (#7465)
* bpo-33274: Compliance with DOM L1: return removed attribute * Update 2018-06-06-22-01-33.bpo-33274.teYqv8.rst
1 parent 7c69c1c commit 5bfa058

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

Lib/test/test_minidom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def testRemoveAttributeNode(self):
325325
node = child.getAttributeNode("spam")
326326
self.assertRaises(xml.dom.NotFoundErr, child.removeAttributeNode,
327327
None)
328-
child.removeAttributeNode(node)
328+
self.assertIs(node, child.removeAttributeNode(node))
329329
self.confirm(len(child.attributes) == 0
330330
and child.getAttributeNode("spam") is None)
331331
dom2 = Document()

Lib/xml/dom/minidom.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,7 @@ def removeAttributeNode(self, node):
823823
# Restore this since the node is still useful and otherwise
824824
# unlinked
825825
node.ownerDocument = self.ownerDocument
826+
return node
826827

827828
removeAttributeNodeNS = removeAttributeNode
828829

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
W3C DOM Level 1 specifies return value of Element.removeAttributeNode() as
2+
"The Attr node that was removed." xml.dom.minidom now complies with this
3+
requirement.

0 commit comments

Comments
 (0)