The TextNode class extends AbstractNode and represents text content within an HTML or XML document. It holds the raw text between the tags of elements, comments, or other nodes. The TextNode itself does not have child nodes but serves as a leaf node in the DOM tree, containing only text data.
As a subclass of AbstractNode, TextNode inherits methods for DOM manipulation, but its behavior is focused on handling textual content. It is primarily used to manipulate or retrieve text inside elements, without interacting with other structural nodes like elements or attributes.
The TextNode class provides specific methods for working with text content, while still being integrated within the broader document structure through its inheritance from AbstractNode.
Declaration
class TextNode extends AbstractCharacterData
Methods
inherited methods
- appendChild
- clearChildNodes
- cloneNode
- getChild
- getChildNodes
- getFirstChild
- getLastChild
- getNextSibling
- getNodeId
- getNodeName
- getNodeType
- getParentElement
- getParentElements
- getParentNode
- getParentNodes
- getPreviousSibling
- hasChild
- hasSibling
- insertAfter
- insertBefore
- insertChildAtPosition
- isVisible
- moveAfterSibling
- moveBeforeSibling
- moveToFirstSibling
- moveToLastSibling
- moveToSiblingPosition
- prependChild
- removeChild
- render
- replaceChild
- setVisible
- sortChildNodes
- toJson