CKEditor 4 Documentation

CKEDITOR.dom.walker

Files

Utility class to "walk" the DOM inside range boundaries. If the range starts or ends in the middle of the text node, this node will be included as a whole. Outside changes to the range may break the walker.

The walker may return nodes that are not totally included in the range boundaries. Let us take the following range representation, where the square brackets indicate the boundaries:

[<p>Some <b>sample] text</b>

While walking forward into the above range, the following nodes are returned: <p>, "Some ", <b> and "sample". Going backwards instead we have: "sample" and "Some ". So note that the walker always returns nodes when "entering" them, but not when "leaving" them. The guard function is instead called both when entering and when leaving nodes.

Properties

Defined By

Instance properties

CKEDITOR.dom.walker
view source
: Objectprivate
...

Defaults to: {}

CKEDITOR.dom.walker
view source
: Function
A function executed for every matched node to check whether it is to be considered in the walk or not. ...

A function executed for every matched node to check whether it is to be considered in the walk or not. If not provided, all matched nodes are considered good.

If the function returns false, the node is ignored.

CKEDITOR.dom.walker
view source
: Function
A function executed for every node the walk passes by to check whether the walk is to be finished. ...

A function executed for every node the walk passes by to check whether the walk is to be finished. It is called both when entering and when exiting nodes, as well as for the matched nodes.

If this function returns false, the walking ends and no more nodes are evaluated.

Defined By

Static properties

CKEDITOR.dom.walker
view source
: Objectstatic
A hash of element names which in browsers that do not need <code>&lt;br&gt;</code> fillers can be...

A hash of element names which in browsers that do not need <code>&lt;br&gt;</code> fillers can be selection containers despite being empty.

Available since: 4.5

Methods

Defined By

Instance methods

CKEDITOR.dom.walker
view source
new( range ) : CKEDITOR.dom.walker
Creates a walker class instance. ...

Creates a walker class instance.

Parameters

Returns

CKEDITOR.dom.walker
view source
( ) : Boolean
Check all nodes on the left, executing the evaluation function. ...

Check all nodes on the left, executing the evaluation function.

Returns

  • Boolean

    false if the evaluator function returned false for any of the matched nodes. Otherwise true.

CKEDITOR.dom.walker
view source
( ) : Boolean
Checks all nodes on the right, executing the evaluation function. ...

Checks all nodes on the right, executing the evaluation function.

Returns

  • Boolean

    false if the evaluator function returned false for any of the matched nodes. Otherwise true.

CKEDITOR.dom.walker
view source
( )
Stops walking. ...

Stops walking. No more nodes are retrieved if this function is called.

Executes a full walk backwards (to the left), until no more nodes are available, returning the last valid node. ...

Executes a full walk backwards (to the left), until no more nodes are available, returning the last valid node.

Returns

Executes a full walk forward (to the right), until no more nodes are available, returning the last valid node. ...

Executes a full walk forward (to the right), until no more nodes are available, returning the last valid node.

Returns

  • CKEDITOR.dom.node

    The last node on the right or null if no valid nodes are available.

CKEDITOR.dom.walker
view source
( ) : CKEDITOR.dom.node
Retrieves the next node (on the right). ...

Retrieves the next node (on the right).

Returns

CKEDITOR.dom.walker
view source
( ) : CKEDITOR.dom.node
Retrieves the previous node (on the left). ...

Retrieves the previous node (on the left).

Returns

CKEDITOR.dom.walker
view source
( )
Resets the walker. ...

Resets the walker.

Defined By

Static methods

CKEDITOR.dom.walker
view source
( customNodeNames ) : Functionstatic
Returns a function which checks whether the node is a block boundary. ...

Returns a function which checks whether the node is a block boundary. See CKEDITOR.dom.element.isBlockBoundary.

Parameters

  • customNodeNames : Object

Returns

  • Function
CKEDITOR.dom.walker
view source
( [isReject] ) : Functionstatic
Returns a function which checks whether the node is a bogus (filler) node from contenteditable element's point of view. ...

Returns a function which checks whether the node is a bogus (filler) node from contenteditable element's point of view.

Parameters

  • isReject : Boolean (optional)

    Defaults to: false

Returns

  • Function
CKEDITOR.dom.walker
view source
( [contentOnly], [isReject] ) : Functionstatic
Returns a function which checks whether the node is a bookmark node or the bookmark node inner content. ...

Returns a function which checks whether the node is a bookmark node or the bookmark node inner content.

Parameters

  • contentOnly : Boolean (optional)

    Whether only test against the text content of a bookmark node instead of the element itself (default).

    Defaults to: false

  • isReject : Boolean (optional)

    Whether to return false for the bookmark node instead of true (default).

    Defaults to: false

Returns

  • Function
CKEDITOR.dom.walker
view source
( [isReject] ) : Functionstatic
Returns a function which checks whether the node can be a container or a sibling of the selection end. ...

Returns a function which checks whether the node can be a container or a sibling of the selection end.

This includes:

  • text nodes (but not whitespaces),
  • inline elements,
  • intersection of CKEDITOR.dtd.$empty and CKEDITOR.dtd.$block (currently it is only <hr>),
  • non-editable blocks (special case — such blocks cannot be containers nor siblings, they need to be selected entirely),
  • empty blocks which can contain text (old IEs only).

Available since: 4.3

Parameters

  • isReject : Boolean (optional)

    Whether to return false for the ignored element instead of true (default).

    Defaults to: false

Returns

  • Function
CKEDITOR.dom.walker
view source
( [isReject] ) : Functionstatic
Returns a function which checks whether the node is empty. ...

Returns a function which checks whether the node is empty.

Available since: 4.5

Parameters

  • isReject : Boolean (optional)

    Whether to return false for the ignored element instead of true (default).

    Defaults to: false

Returns

  • Function
CKEDITOR.dom.walker
view source
( [isReject] ) : Functionstatic
Returns a function which checks whether the node should be ignored in terms of "editability". ...

Returns a function which checks whether the node should be ignored in terms of "editability".

This includes:

Available since: 4.3

Parameters

  • isReject : Boolean (optional)

    Whether to return false for the ignored element instead of true (default).

    Defaults to: false

Returns

  • Function
CKEDITOR.dom.walker
view source
( [isReject] ) : Functionstatic
Returns a function which checks whether the node is invisible in the WYSIWYG mode. ...

Returns a function which checks whether the node is invisible in the WYSIWYG mode.

Parameters

  • isReject : Boolean (optional)

    Defaults to: false

Returns

  • Function
CKEDITOR.dom.walker
view source
( )static
...
CKEDITOR.dom.walker
view source
( type, [isReject] ) : Functionstatic
Returns a function which checks whether the node type is equal to the passed one. ...

Returns a function which checks whether the node type is equal to the passed one.

Parameters

  • type : Number
  • isReject : Boolean (optional)

    Defaults to: false

Returns

  • Function
CKEDITOR.dom.walker
view source
( [isReject] ) : Functionstatic
Returns a function which checks whether the node is a temporary element (element with the data-cke-temp attribute) or...

Returns a function which checks whether the node is a temporary element (element with the data-cke-temp attribute) or its child.

Available since: 4.3

Parameters

  • isReject : Boolean (optional)

    Whether to return false for the temporary element instead of true (default).

    Defaults to: false

Returns

  • Function
CKEDITOR.dom.walker
view source
( [isReject] ) : Functionstatic
Returns a function which checks whether the node is a text node containing only whitespace characters. ...

Returns a function which checks whether the node is a text node containing only whitespace characters.

Parameters

  • isReject : Boolean (optional)

    Defaults to: false

Returns

  • Function