Interface WalkerMovementMethods

Methods used to move through the nodes of a document in a Walker.

Hierarchy

  • WalkerMovementMethods

Index

Methods

caret

  • caret(): boolean
  • Moves to the position of the editor caret.

    Returns boolean

    Whether or not the move is allowed.

childField

  • childField(fieldNum: number): boolean
  • Moves to the start of the indicated child field of the node at the current position. Equivalent to walker.childNode(fieldNum, 0). If the field is negative, the method counts backward from the last field. Hence, childField(-1) would move to the start of the last field.

    Parameters

    • fieldNum: number

    Returns boolean

    Whether or not the move is allowed.

childNode

  • childNode(fieldNum: number, indexOfNodeInField: number): boolean
  • Moves to the specified offset from the start of the indicated child field of the node at the current position.

    Parameters

    • fieldNum: number
    • indexOfNodeInField: number

    Returns boolean

    Whether or not the move is allowed.

documentEnd

  • documentEnd(): boolean
  • Moves to the end of the document.

    Returns boolean

    Whether or not the move is allowed.

documentStart

  • documentStart(): boolean
  • Moves to the start of the document.

    Returns boolean

    Whether or not the move is allowed.

fieldEnd

  • fieldEnd(): boolean
  • Moves to the end of the same field that includes the current position. The value of walker.node at this position will always be null.

    Returns boolean

    Whether or not the move is allowed.

fieldStart

  • fieldStart(): boolean
  • Moves to the start of the same field that includes the current position.

    Returns boolean

    Whether or not the move is allowed.

left

  • left(): boolean
  • Moves toward the start of the document, moving through the children of any nodes in reverse order. The effect is the same as using the moveLeft command, except that this method affects the walker position rather than the document caret.

    Returns boolean

    Whether or not the move is allowed.

line

  • line(lineNumber: number): boolean
  • Moves to the start of the specified line, counting from 0. Negative numbers count backward from the end of the document. Hence, line(-1) would move to the start of the last line.

    Parameters

    • lineNumber: number

      The line number to move to, from 0. If negative, counts from the document end.

    Returns boolean

    Whether or not the move is allowed.

next

  • next(): boolean
  • Moves toward the end of the document without visiting the children of nodes as they are crossed. For example, this can be called repeatedly to visit every node in a field without "entering" any of those nodes.

    Returns boolean

    Whether or not the move is allowed.

node

  • node(target: Node): boolean
  • Moves to the position of the target node. The target node must be part of the editor document that this walker was created for. It cannot be the document root as the root cannot be described by any position.

    Parameters

    • target: Node

      The node to move to; if successful, a new node inserted at this position will appear just before the target.

    Returns boolean

    Whether or not the move is allowed.

parent

  • parent(): boolean
  • Moves to the position of the parent node that contains the current position.

    Returns boolean

    Whether or not the move is allowed.

prev

  • prev(): boolean
  • Moves toward the start of the document without visiting the children of nodes as they are crossed. For example, this can be called repeatedly to visit every node in a field without "entering" any of those nodes.

    Returns boolean

    Whether or not the move is allowed.

relativePosition

  • relativePosition(parent: Node, fieldNum: number, indexOfNodeInField: number): boolean
  • Moves to a position inside of the target node. The target node must be part of the editor document that this walker was created for, the specified field must exist on that node, and the index must refer to a node in that field or the field end.

    Parameters

    • parent: Node

      The non-null parent node that will contain the new position.

    • fieldNum: number

      The index of the child field, from 0 to numFields-1.

    • indexOfNodeInField: number

      The index of the node within the field, from 0 to the length of the specified field.

    Returns boolean

    Whether or not the move is allowed.

right

  • right(): boolean
  • Moves toward the end of the document, moving through the children of any nodes before traversing them. The effect is the same as using the moveRight command, except that this method affects the walker position rather than the document caret.

    Returns boolean

    Whether or not the move is allowed.

selectionEnd

  • selectionEnd(): boolean
  • Moves to the end of the editor selection. If there is no selection, moves to the position of the caret.

    Returns boolean

    Whether or not the move is allowed.

selectionStart

  • selectionStart(): boolean
  • Moves to the start of the editor selection. If there is no selection, moves to the position of the caret.

    Returns boolean

    Whether or not the move is allowed.

This API is still under development and is subject to change. Copyright © Math I Can Do Solutions Incorporated and/or its licensors.