-
-
Notifications
You must be signed in to change notification settings - Fork 7
API
- contains
- getChildAt
- getChildren
- getFirstChild
- getLastChild
- getNextSibling
- getParent
- getPreviousSibling
- hasChildren
- isLastChild
Returns a boolean value indicating whether a node is a descendant of a given node or not.
- node (Object): Specifies the node that may be contained by (a descendant of) a specified node.
(boolean): Returns true if a node is a descendant of a specified node, otherwise false. A descendant can be a child, grandchild, great-grandchild, and so on.
rootNode.contains(node);
// → true
node.contains(rootNode);
// → false
Gets a child node at the specified index.
- index (number): The index of the child node.
(Object): Returns a Node object of the specified child, null otherwise.
node.getChildAt(-1);
// → null
node.getChildAt(0);
// → Node {}
Gets the child nodes.
(Array): Returns an array of Node objects containing the child nodes.
node.getChildren();
// → [Node {}, Node {}]
Gets the first child node.
(Object): Returns a Node object of the first child, null otherwise.
node.getFirstChild();
// → Node {}
Gets the last child node.
(Object): Returns a Node object of the last child, null otherwise.
node.getLastChild();
// → Node {}
Gets the next sibling node.
(Object): Returns a Node object of the next sibling, null otherwise.
node.getNextSibling();
// → Node {}
Gets the parent node.
(Object): Returns a Node object of the parent, null otherwise.
node.getParent();
// → Node {}
Gets the previous sibling node.
(Object): Returns a Node object of the previous sibling, null otherwise.
node.getPreviousSibling();
// → Node {}
Checks whether this node has children.
(boolean): Returns true if the node has children, false otherwise.
node.hasChildren();
// → true
Checks whether this node is the last child of its parent.
(boolean): Returns true if the node is the last child of its parent, false otherwise.
node.isLastChild();
// → true