Skip to content

Commit 6b9b489

Browse files
Merge remote-tracking branch 'upstream/main' into gh-44871-minidom-level-1
2 parents c3b3b59 + 74b944a commit 6b9b489

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

Doc/library/xml.dom.minidom.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,11 @@ rules apply:
273273
Previously, many invalid operations silently succeeded
274274
and produced an invalid document.
275275

276+
* :meth:`~xml.dom.Element.removeAttribute` and
277+
:meth:`~xml.dom.Element.removeAttributeNS` raise
278+
:exc:`~xml.dom.NotFoundErr` if there is no matching attribute,
279+
while the DOM specifies that this has no effect.
280+
276281
The following interfaces have no implementation in :mod:`!xml.dom.minidom`:
277282

278283
* :class:`DOMTimeStamp`

Doc/library/xml.dom.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ for each node type are:
467467
.. method:: Node.insertBefore(newChild, refChild)
468468

469469
Insert a new child node before an existing child. It must be the case that
470-
*refChild* is a child of this node; if not, :exc:`ValueError` is raised.
470+
*refChild* is a child of this node; if not, :exc:`NotFoundErr` is raised.
471471
*newChild* is returned. If *refChild* is ``None``, it inserts *newChild* at the
472472
end of the children's list.
473473

@@ -479,15 +479,15 @@ for each node type are:
479479
.. method:: Node.removeChild(oldChild)
480480

481481
Remove a child node. *oldChild* must be a child of this node; if not,
482-
:exc:`ValueError` is raised. *oldChild* is returned on success. If *oldChild*
482+
:exc:`NotFoundErr` is raised. *oldChild* is returned on success. If *oldChild*
483483
will not be used further, its :meth:`~xml.dom.minidom.Node.unlink` method
484484
should be called.
485485

486486

487487
.. method:: Node.replaceChild(newChild, oldChild)
488488

489489
Replace an existing node with a new node. It must be the case that *oldChild*
490-
is a child of this node; if not, :exc:`ValueError` is raised.
490+
is a child of this node; if not, :exc:`NotFoundErr` is raised.
491491

492492
Raise :exc:`WrongDocumentErr` if *newChild* was created by another
493493
document, and :exc:`HierarchyRequestErr` if it is this node itself or
@@ -860,8 +860,7 @@ of that class.
860860

861861
.. method:: Element.removeAttribute(name)
862862

863-
Remove an attribute by name. If there is no matching attribute, a
864-
:exc:`NotFoundErr` is raised.
863+
Remove an attribute by name.
865864

866865

867866
.. method:: Element.removeAttributeNode(oldAttr)
@@ -872,8 +871,7 @@ of that class.
872871

873872
.. method:: Element.removeAttributeNS(namespaceURI, localName)
874873

875-
Remove an attribute by name. Note that it uses a localName, not a qname. No
876-
exception is raised if there is no matching attribute.
874+
Remove an attribute by name. Note that it uses a localName, not a qname.
877875

878876

879877
.. method:: Element.setAttribute(name, value)

0 commit comments

Comments
 (0)