Properties
canContainContentabstract
#
Check if the node can contain content.
- Source:
canHaveChildrenabstract
#
Check if the node can have children.
- Source:
canHaveChildrenNotContentabstract
#
Check if the node can have children but not content nor be content.
- Source:
getChildNodeTypesabstract
#
Get allowed child node types.
- Source:
getLengthabstract
#
Get the length of the node.
- Source:
getOffsetabstract
#
Get the offset of the node within the document.
If the node has no parent than the result will always be 0.
- Source:
getParentNodeTypesabstract
#
Get allowed parent node types.
- Source:
getSuggestedParentNodeTypesabstract
#
Get suggested parent node types.
- Source:
handlesOwnChildrenabstract
#
Check if the node handles its own children
- Source:
hasSignificantWhitespaceabstract
#
Check if the node has significant whitespace.
Can only be true if canContainContent is also true.
- Source:
isAlignableabstract
#
Check if the node is alignable
- Source:
isCellEditableabstract
#
Check the node, behaving as a table cell, can be edited in place
- Source:
isCellableabstract
#
Check if the node can behave as a table cell
- Source:
isContentabstract
#
Check if the node is content.
- Source:
isDiffedAsDocumentabstract
#
Check if the node behaves like a document for diffing
- Source:
isDiffedAsLeafabstract
#
Check if the node behaves like a leaf for diffing
- Source:
isDiffedAsListabstract
#
Check if the node behaves like a list for diffing
- Source:
isFocusableabstract
#
Check if the node is focusable
- Source:
isInternalabstract
#
Check if the node is an internal node
- Source:
isMetaDataabstract
#
Check if the node is a meta data node
- Source:
isUnwrappableabstract
#
Check if the node can be unwrapped.
Can only be true of the node is wrapped.
- Source:
isWrappedabstract
#
Check if the node has a wrapped element in the document data.
- Source:
shouldIgnoreChildrenabstract
#
Check if the node's children should be ignored.
- Source:
Methods
attach(parent)
#
Attach the node to another as a child.
Parameters:
Name | Type | Description |
---|---|---|
parent |
ve.Node | Node to attach to |
- Source:
Fires:
collectUpstream() → {Array.<ve.Node>}
#
Traverse upstream and collect all nodes, including the node itself.
- Source:
Returns:
List of nodes which are upstream of the current node
detach()
#
findParent(type) → {ve.Node|null
}
#
null
}
#
Traverse upstream until a parent of a specific type is found
Parameters:
Name | Type | Description |
---|---|---|
type |
function | Node type to find |
- Source:
Returns:
Ancestor of this node matching the specified type
- Type
-
ve.Node
|
null
getDocument() → {ve.Document|null
}
#
null
}
#
Get the document the node is a part of.
- Source:
Returns:
Document the node is a part of, null if detached
- Type
-
ve.Document
|
null
getOffsetPath() → {Array.<number>|null
}
#
null
}
#
Get the offset path from the document node to this node.
- Source:
Returns:
The offset path, or null if not attached to a DocumentNode
- Type
-
Array.<number>
|
null
getOuterLength() → {number}
#
Get the outer length of the node, which includes wrappers if present.
- Source:
Returns:
Node outer length
- Type
- number
getOuterRange(backwards) → {ve.Range}
#
Get the outer range of the node, which includes wrappers if present.
Parameters:
Name | Type | Description |
---|---|---|
backwards |
boolean | Return a backwards range |
- Source:
Returns:
Node outer range
- Type
- ve.Range
getParent() → {ve.Node|null
}
#
null
}
#
Get a reference to the node's parent.
- Source:
Returns:
Reference to the node's parent, null if detached
- Type
-
ve.Node
|
null
getRange(backwards) → {ve.Range}
#
Get the range inside the node.
Parameters:
Name | Type | Description |
---|---|---|
backwards |
boolean | Return a backwards range |
- Source:
Returns:
Inner node range
- Type
- ve.Range
getRoot() → {ve.Node|null
}
#
null
}
#
Get the root node of the tree the node is currently attached to.
- Source:
Returns:
Root node, null if detached
- Type
-
ve.Node
|
null
getType() → {string}
#
Get the symbolic node type name.
- Source:
Returns:
Symbolic name of element type
- Type
- string
isAllowedChildNodeType(type) → {boolean}
#
Check if the specified type is an allowed child node type
Parameters:
Name | Type | Description |
---|---|---|
type |
string | Node type |
- Source:
Returns:
The type is allowed
- Type
- boolean
isAllowedParentNodeType(type) → {boolean}
#
Check if the specified type is an allowed child node type
Parameters:
Name | Type | Description |
---|---|---|
type |
string | Node type |
- Source:
Returns:
The type is allowed
- Type
- boolean
isDiffedAsTree() → {boolean}abstract
#
Check if the node behaves like a tree branch for diffing
This is the fallback behaviour if the node is not diffed as a list,leaf or document.
- Source:
Returns:
Node behaves like a tree branch
- Type
- boolean
Check if the node behaves like a tree branch for diffing
This is the fallback behaviour if the node is not diffed as a list,leaf or document.
isDownstreamOf(upstreamNode) → {boolean}
#
Check if the current node is a descendant of (or equal to) a specific node.
Parameters:
Name | Type | Description |
---|---|---|
upstreamNode |
ve.Node | Parent node to check for |
- Source:
Returns:
Current node is a descendant
- Type
- boolean
setDocument(doc)
#
Set the document the node is a part of.
This method is overridden by nodes with children.
Parameters:
Name | Type | Description |
---|---|---|
doc |
ve.Document
|
null
|
Document this node is a part of |
- Source:
setRoot(root)
#
Set the root node.
This method is overridden by nodes with children.
Parameters:
Name | Type | Description |
---|---|---|
root |
ve.Node
|
null
|
Node to use as root |
- Source:
Fires:
traverseUpstream(callback) → {ve.Node|null
}
#
null
}
#
Traverse tree of nodes (model or view) upstream.
For each traversed node, the callback function will be passed the traversed node as a parameter.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | Callback method to be called for every traversed node. Returning false stops the traversal. |
- Source:
Returns:
Node which caused the traversal to stop, or null if it didn't
- Type
-
ve.Node
|
null
Events
attach(New)
#
detach(Old)
#
root(New)
#
The node has a new root assigned.
The root will be consistent with that set in descendants and ancestors, but other parts of the tree may be inconsistent.
Parameters:
Name | Type | Description |
---|---|---|
New |
ve.Node | root |
- Source: