Constructor
new ve.BranchNode(children)abstract
#
Branch node mixin.
Extenders are expected to inherit from ve.Node.
Branch nodes are immutable, which is why there are no methods for adding or removing children. DataModel classes will add this functionality, and other subclasses will implement behavior that mimics changes made to DataModel nodes.
Parameters:
- Source:
Methods
getNodeFromOffset(offset, [shallow]) → {ve.Node|null
}
#
null
}
#
Get a node from an offset.
This method is pretty expensive. If you need to get different slices of the same content, get the content first, then slice it up locally.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
offset |
number | Offset get node for |
|
shallow |
boolean |
optional |
Do not iterate into child nodes of child nodes |
- Source:
Returns:
Node at offset, or null if none was found
- Type
-
ve.Node
|
null
Throws:
-
If offset is out of bounds
- Type
- Error
hasChildren() → {boolean}
#
Check if the node has children.
- Source:
Returns:
Whether the node has children
- Type
- boolean
indexOf(node) → {number}
#
Get the index of a child node.
Parameters:
Name | Type | Description |
---|---|---|
node |
ve.dm.Node | Child node to find index of |
- Source:
Returns:
Index of child node or -1 if node was not found
- Type
- number
setDocument(doc)
#
Set the document the node is a part of.
Parameters:
Name | Type | Description |
---|---|---|
doc |
ve.Document | Document this node is a part of |
- Source:
- See:
setRoot(root)
#
Set the root node.
Parameters:
Name | Type | Description |
---|---|---|
root |
ve.BranchNode
|
null
|
Node to use as root |
- Source:
- See: