Visits every node in the editor document. Note that the document root is not visited, since it does not have a position inside the document. The document root node would be the first and last node visited, so it can easily be handled as a special case if desired.
The function to be invoked on each node.
Visits the node at the current walker position, if any. (As with all visits, all of the node's descendants are also visited.)
The function to be invoked on each node.
Visits the nodes in the current editor selection, if any.
The function to be invoked on each node.
This API is still under development and is subject to change. Copyright © Math I Can Do Solutions Incorporated and/or its licensors.
Methods used to visit document content from a Walker. The specific method determines which subset of the document's nodes will be visited. Visitation consists of traversing the selected document subset one node at a time, in order from the start of the document toward the end. For each node, the specified visitor function is called multiple times:
"before"
."beforeField"
and a field value indicating the field number (0 for the first field)."afterField"
and the field number."after"
.Example: Visitation order for ½ x
Before each call to the visitor function, the walker position is updated to match the position of the visited node. Note that regardless of stage, the position is always the same: if the position were a caret position, the caret would be just before the node.
The order of node visits is determined by the document structure when the visit began. If a node is moved while visiting, it will be visited in its original order as if it had not moved. If a new node is inserted while visiting, it will be skipped by the visitor as if it were not present. If a node is removed while visiting, no further visits to that node will be made. Thus, if a node is removed at the
"before"
stage, then no"after"
stage will occur, no fields will be visited, and none of node's children will be visited at all.