]> granicus.if.org Git - python/commitdiff
bpo-33274: Compliance with DOM L1: return removed attribute (#7465)
authorarikrupnik <ari@30pins.com>
Thu, 7 Jun 2018 04:42:38 +0000 (23:42 -0500)
committerFred Drake <fred@fdrake.net>
Thu, 7 Jun 2018 04:42:38 +0000 (00:42 -0400)
* bpo-33274: Compliance with DOM L1: return removed attribute

* Update 2018-06-06-22-01-33.bpo-33274.teYqv8.rst

Lib/test/test_minidom.py
Lib/xml/dom/minidom.py
Misc/NEWS.d/next/Library/2018-06-06-22-01-33.bpo-33274.teYqv8.rst [new file with mode: 0644]

index a2cc8828461d3e95eeff7c2e4ce57a69b763c5d1..e91cdba1eb2eff0c20e50e9806a1ff74671dcb29 100644 (file)
@@ -325,7 +325,7 @@ class MinidomTest(unittest.TestCase):
         node = child.getAttributeNode("spam")
         self.assertRaises(xml.dom.NotFoundErr, child.removeAttributeNode,
             None)
-        child.removeAttributeNode(node)
+        self.assertIs(node, child.removeAttributeNode(node))
         self.confirm(len(child.attributes) == 0
                 and child.getAttributeNode("spam") is None)
         dom2 = Document()
index a5d813f932ace36e2dbf8afcd780ca48551a3b81..e44e04a069ecb4db2b2698a4536f6f5656cea63b 100644 (file)
@@ -823,6 +823,7 @@ class Element(Node):
         # Restore this since the node is still useful and otherwise
         # unlinked
         node.ownerDocument = self.ownerDocument
+        return node
 
     removeAttributeNodeNS = removeAttributeNode
 
diff --git a/Misc/NEWS.d/next/Library/2018-06-06-22-01-33.bpo-33274.teYqv8.rst b/Misc/NEWS.d/next/Library/2018-06-06-22-01-33.bpo-33274.teYqv8.rst
new file mode 100644 (file)
index 0000000..420652b
--- /dev/null
@@ -0,0 +1,3 @@
+W3C DOM Level 1 specifies return value of Element.removeAttributeNode() as
+"The Attr node that was removed." xml.dom.minidom now complies with this
+requirement.