Editor.Walker

Walker for DOM.

defined in: walker.js

Class

Attributes

  • this.evaluator {Function} A function executed for every matched node, to check whether it's to be considered into the walk or not.
  • this.guard {Function} A function executed for every node the walk pass by to check whether the walk is to be finished.

Methods

  • Editor.Walker. blockBoundary (customNodeNames) <static> Whether the to-be-evaluated node is not a block node and does not match given node name map.
  • Editor.Walker. bookmark (contentOnly, isReject) <static> Whether the to-be-evaluated node is a bookmark node OR bookmark node inner contents.
  • checkBackward () Check all nodes at left, executing the evaluation function.
  • checkForward () Check all nodes at right, executing the evaluation function.
  • end () Stop walking.
  • Editor.Walker. invisible (isReject) <static> Whether the node is invisible in wysiwyg mode.
  • lastBackward () Executes a full walk backwards (to the left), until no more nodes are available, returning the last valid node.
  • lastForward () Executes a full walk forward (to the right), until no more nodes are available, returning the last valid node.
  • next () Retrieves the next node (at right).
  • previous () Retrieves the previous node (at left).
  • Editor.Walker. whitespaces (isReject) <static> Whether the node is a text node containing only whitespaces characters.

Class Detail

  • Editor.Walker (range)
    Walker for DOM.
    Parameters

Attributes Detail

  • this.evaluator {Function} A function executed for every matched node, to check whether it's to be considered into the walk or not. If not provided, all matched nodes are considered good. If the function returns "FALSE" the node is ignored.
  • this.guard {Function} A function executed for every node the walk pass by to check whether the walk is to be finished. It's called when both entering and exiting nodes, as well as for the matched nodes. If this function returns "FALSE", the walking ends and no more nodes are evaluated.

Methods Detail

  • Editor.Walker. blockBoundary (customNodeNames) <static> view source
    Whether the to-be-evaluated node is not a block node and does not match given node name map.
    Parameters
    •   customNodeNames {Object} Given node name map.
    Returns
    • {Function} Function for evaluation.
  • Editor.Walker. bookmark (contentOnly, isReject) <static> view source
    Whether the to-be-evaluated node is a bookmark node OR bookmark node inner contents.
    Parameters
    • [ contentOnly ] {Boolean} Whether only test againt the text content of bookmark node instead of the element itself(default).
    • [ isReject ] {Boolean} Whether should return 'FALSE' for the bookmark node instead of 'TRUE'(default).
    Returns
    • {Function} Function for evaluation.
  • checkBackward () view source
    Check all nodes at left, executing the evaluation function. 是不是 (不能后退了)
    Returns
    • {Boolean} "FALSE" if the evaluator function returned "FALSE" for any of the matched nodes. Otherwise "TRUE".
  • checkForward () view source
    Check all nodes at right, executing the evaluation function.
    Returns
    • {Boolean} "FALSE" if the evaluator function returned "FALSE" for any of the matched nodes. Otherwise "TRUE".
  • end () view source
    Stop walking. No more nodes are retrieved if this function gets called.
  • Editor.Walker. invisible (isReject) <static> view source
    Whether the node is invisible in wysiwyg mode.
    Parameters
    •   isReject
  • lastBackward () view source
    Executes a full walk backwards (to the left), until no more nodes are available, returning the last valid node.
    Returns
    • {Boolean} The last node at the left or NULL if no valid nodes are available.
  • lastForward () view source
    Executes a full walk forward (to the right), until no more nodes are available, returning the last valid node.
    Returns
    • {Boolean} The last node at the right or NULL if no valid nodes are available.
  • next () view source
    Retrieves the next node (at right).
    Returns
    • {Boolean} The next node or NULL if no more nodes are available.
  • previous () view source
    Retrieves the previous node (at left).
    Returns
    • {Boolean} The previous node or NULL if no more nodes are available.
  • Editor.Walker. whitespaces (isReject) <static> view source
    Whether the node is a text node containing only whitespaces characters.
    Parameters
    • [ isReject ] {Boolean}
blog comments powered by Disqus
Top