class Node
Node is an abstract class that is inherited by Element, Text and Comment classes.
properties:
nodeName
string, read-only, one of
| Value | Node Type |
|---|---|
| "#comment" | Comment |
| "#text" | Text |
| "#document" | Document |
| The value of element.tagName | Element |
nodeType
read-only, integer, node type
nodeValue
- Text and Comment nodes - read-write, string, text of the node;
- other node types - read-only, null
nodeIndex
read-only, integer, index of the node in its parent collection.
childNodes
read-only, returns a NodeList containing all children.
firstChild
lastChild
read-only, returns first/last child Node.
nextSibling
previousSibling
read-only, returns next/previous sibling Node.
parentNode
parentElement
read-only, reference of parent element.
ownerDocument
read-only, owning document reference.
parentWindow
read-only instance of Window that hosts this node;
textContent
- Text and Comment nodes - read-only, string, text of the node;
- other node types - textual content of an element - concatenation of textContent of all its descendants
methods:
cloneNode()
const clone = node.cloneNode();
In Sciter this method always does deep cloning.
contains()
node.contains(otherNode): boolean
returns true if this node contains other node as a descendant.
### compareDocumentPosition()
not implemened yet.
getRootNode()
node.getRootNode(): Document | null
read-only, in Sciter it always reports ownerDocument.
hasChildNodes()
node.hasChildNodes(): bool
reports true if it has child nodes.
isEqualNode()
node.isEqualNode(otherNode): bool
reports true if it has child nodes.
isSameNode()
node.isSameNode(otherNode): bool
reports true if node === otherNode
remove()
node.remove()
method removes the node from the DOM.
static methods:
commonParent()
Node.commonParent(nodeA,nodeB):Element
returns nearest common parent element of two nodes;
static constants:
NodeType
Node.ELEMENT_NODENode.ATTRIBUTE_NODENode.TEXT_NODENode.CDATA_SECTION_NODENode.PROCESSING_INSTRUCTION_NODENode.COMMENT_NODENode.DOCUMENT_NODENode.DOCUMENT_TYPE_NODENode.DOCUMENT_FRAGMENT_NODE