Expand all

abstract ve.Node

Constructor

new ve.Node()abstract #

Generic node.

Mixes in:
Source:
Generic node.

Properties

canContainContentabstract #

Check if the node can contain content.

Source:
Check if the node can contain content.

canHaveChildrenabstract #

Check if the node can have children.

Source:
Check if the node can have children.

canHaveChildrenNotContentabstract #

Check if the node can have children but not content nor be content.

Source:
Check if the node can have children but not content nor be content.

getChildNodeTypesabstract #

Get allowed child node types.

Source:
Get allowed child node types.

getLengthabstract #

Get the length of the node.

Source:
Get the length of the node.

getOffsetabstract #

Get the offset of the node within the document.

If the node has no parent than the result will always be 0.

Source:
Get the offset of the node within the document.

getParentNodeTypesabstract #

Get allowed parent node types.

Source:
Get allowed parent node types.

getSuggestedParentNodeTypesabstract #

Get suggested parent node types.

Source:
Get suggested parent node types.

handlesOwnChildrenabstract #

Check if the node handles its own children

Source:
Check if the node handles its own children

hasSignificantWhitespaceabstract #

Check if the node has significant whitespace.

Can only be true if canContainContent is also true.

Source:
Check if the node has significant whitespace.

isAlignableabstract #

Check if the node is alignable

Source:
Check if the node is alignable

isCellEditableabstract #

Check the node, behaving as a table cell, can be edited in place

Source:
Check the node, behaving as a table cell, can be edited in place

isCellableabstract #

Check if the node can behave as a table cell

Source:
Check if the node can behave as a table cell

isContentabstract #

Check if the node is content.

Source:
Check if the node is content.

isDiffedAsDocumentabstract #

Check if the node behaves like a document for diffing

Source:
Check if the node behaves like a document for diffing

isDiffedAsLeafabstract #

Check if the node behaves like a leaf for diffing

Source:
Check if the node behaves like a leaf for diffing

isDiffedAsListabstract #

Check if the node behaves like a list for diffing

Source:
Check if the node behaves like a list for diffing

isFocusableabstract #

Check if the node is focusable

Source:
Check if the node is focusable

isInternalabstract #

Check if the node is an internal node

Source:
Check if the node is an internal node

isMetaDataabstract #

Check if the node is a meta data node

Source:
Check if the node is a meta data node

isUnwrappableabstract #

Check if the node can be unwrapped.

Can only be true of the node is wrapped.

Source:
Check if the node can be unwrapped.

isWrappedabstract #

Check if the node has a wrapped element in the document data.

Source:
Check if the node has a wrapped element in the document data.

shouldIgnoreChildrenabstract #

Check if the node's children should be ignored.

Source:
Check if the node's children should be ignored.

Methods

attach(parent) #

Attach the node to another as a child.

Parameters:

Name Type Description
parent ve.Node

Node to attach to

Source:

Fires:

Attach the node to another as a child.

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

Type
Array.<ve.Node>
Traverse upstream and collect all nodes, including the node itself.

detach() #

Detach the node from its parent.

Source:

Fires:

Detach the node from its parent.

findParent(type) → {ve.Node|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
Traverse upstream until a parent of a specific type is found

getDocument() → {ve.Document|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
Get the document the node is a part of.

getOffsetPath() → {Array.<number>|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
Get the offset path from the document node to this node.

getOuterLength() → {number} #

Get the outer length of the node, which includes wrappers if present.

Source:

Returns:

Node outer length

Type
number
Get the outer length of the node, which includes wrappers if present.

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
Get the outer range of the node, which includes wrappers if present.

getParent() → {ve.Node|null} #

Get a reference to the node's parent.

Source:

Returns:

Reference to the node's parent, null if detached

Type
ve.Node | null
Get a reference to the node's parent.

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
Get the range inside the node.

getRoot() → {ve.Node|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
Get the root node of the tree the node is currently attached to.

getType() → {string} #

Get the symbolic node type name.

Source:

Returns:

Symbolic name of element type

Type
string
Get the symbolic node type name.

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
Check if the specified type is an allowed child node type

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
Check if the specified type is an allowed child node type

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
Check if the current node is a descendant of (or equal to) a specific node.

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:
Set the document the node is a part of.

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:

Set the root node.

traverseUpstream(callback) → {ve.Node|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
Traverse tree of nodes (model or view) upstream.

Events

attach(New) #

Parameters:

Name Type Description
New ve.Node

parent

Source:

detach(Old) #

Parameters:

Name Type Description
Old ve.Node

parent

Source:

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:
The node has a new root assigned.

unroot(Old) #

The node root has been set to null.

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
Old ve.Node

root

Source:
The node root has been set to null.