gh-151943: Document the CharacterData interface and other DOM members - #155632
Open
serhiy-storchaka wants to merge 11 commits into
Open
gh-151943: Document the CharacterData interface and other DOM members#155632serhiy-storchaka wants to merge 11 commits into
serhiy-storchaka wants to merge 11 commits into
Conversation
…embers CharacterData was not mentioned at all, although Text, Comment and CDATASection inherit from it. Also document members which are implemented, but were omitted: Node.ownerDocument, Node.isSupported(), Node.getUserData(), Node.setUserData(), Document.doctype, Document.implementation, Document.documentURI, Document.strictErrorChecking, Document.createDocumentFragment(), Document.createCDATASection(), Document.importNode(), Document.renameNode(), Element.setIdAttribute(), Element.setIdAttributeNS(), Element.setIdAttributeNode(), Attr.isId, Attr.ownerElement, Text.wholeText, Text.splitText() and Text.replaceWholeText().
Documentation build overview
61 files changed ·
|
…Map methods Add class directives for all documented DOM classes, so that references to them resolve. They use :no-typesetting:, because the classes are not instantiated directly and the sections already introduce them. Add a section for DocumentFragment, which was referenced, but had no section of its own, and document Document.getElementById() and the getNamedItem(), setNamedItem() and removeNamedItem() families of NamedNodeMap, which are implemented, but were omitted. Silence references to the illustrative names in the IDL mapping example and to the PYTHON_DOM environment variable.
…bers The node type constants and the exception code constants were referenced, but never documented. Document them, including ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE and VALIDATION_ERR, which were not even mentioned, and the ValidationErr exception. Qualify references to attributes and methods with the class which defines them, so that they resolve, and refer to xml.dom.minidom for unlink(), which is not part of the DOM.
It no longer produces warnings in the Sphinx nit-picky mode.
serhiy-storchaka
requested review from
AA-Turner,
StanFromIreland and
hugovk
as code owners
August 12, 2026 17:37
….specified Entity and Notation were not mentioned at all, although they are implemented and DocumentType.entities and DocumentType.notations contain such nodes.
dgelessus
reviewed
Aug 27, 2026
Co-authored-by: dgelessus <dgelessus@users.noreply.github.com>
…Attr CDATASection extends Text, as in the DOM Level 1 and Level 2 IDL. NodeList.item() returns None for an index out of range, it does not forbid such index. Attribute nodes are not part of the document tree.
Reported in pythongh-156388: * which node types can have children, and of which types; * the values of nodeName and nodeValue for every node type; * childNodes is a NodeList; * NodeList does not inherit from Node; * when DocumentType.publicId and systemId are None; * "minidom" is the only well-known implementation name; * which mapping methods minidom adds to a NamedNodeMap, and where they are not available.
It is a list subclass, not a replacement for NodeList, and nodes which cannot have children use a tuple subclass. Remove the note about earlier versions of Python which did not support the official API.
The table above gives the value for every node type, and none of them is None.
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this pull request
Aug 28, 2026
…nd NEWS Suggested by dgelessus in the review of pythonGH-155632, where the same wording was used.
Member
Author
|
I applied suggestions and addressed more points from #156388. |
… docs Each of the NodeList and NamedNodeMap interfaces has two implementations in minidom, which support additional operations. Move this and the notes about strictErrorChecking and Attr.specified out of the documentation of the generic DOM interface.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
CharacterDatainterface was not mentioned in the documentation at all, althoughText,CommentandCDATASectioninherit from it, so itslengthattribute and mutation methods were not documented.Other implemented members which were omitted are documented too:
Node.ownerDocument,Node.isSupported(),Node.getUserData(),Node.setUserData(),Document.doctype,Document.implementation,Document.documentURI,Document.strictErrorChecking,Document.createDocumentFragment(),Document.createCDATASection(),Document.importNode(),Document.renameNode(),Element.setIdAttribute(),Element.setIdAttributeNS(),Element.setIdAttributeNode(),Attr.isId,Attr.ownerElement,Text.wholeText,Text.splitText()andText.replaceWholeText().Doc/library/{xml*,pyexpat}.rst#151943xml.domdocs are missing important information necessary for usage #156388