We use cookies to make our website more effective. By using our website you agree to our privacy policy.

Namespace: traversing

traversing

traversing.js is part of Aloha Editor project http://www.alohaeditor.org

Aloha Editor ● JavaScript Content Editing Library
Copyright (c) 2010-2015 Gentics Software GmbH, Vienna, Austria.
Contributors http://www.alohaeditor.org/docs/contributing.html

Methods

expand(start, end, unit){Array.<Boundary>}

Expands the given boundaries to contain the given unit.

The second parameter `unit` specifies the unit with which to expand.
This value may be one of the following strings:

"word" -- Expand to completely contain a word.

A word is the smallest semantic unit. It is a contigious sequence
of characters terminated by a space or puncuation character or a
word-breaker (in languages that do not use space to delimit word
boundaries).

"block" -- Expand to completely contain a block.
Name Type Description
start Boundary
end Boundary
unit unit

isAtEnd(boundary){boolean}

Checks whether a boundary represents a position that at the apparent end
of its container's content.

Unlike Boundaries.isAtEnd(), it considers the boundary position with
respect to how it is visually represented, rather than simply where it
is in the DOM tree.
Name Type Description
boundary Boundary

isAtStart(boundary){boolean}

Checks whether a boundary represents a position that at the apparent
start of its container's content.

Unlike Boundaries.isAtStart(), it considers the boundary position with
respect to how it is visually represented, rather than simply where it
is in the DOM tree.
Name Type Description
boundary Boundary

isBoundariesEqual(left, right){boolean}

Checks whether the left boundary is at the same visual position as the
right boundary.

Take note that the order of the boundary is important:
(left, right) is not necessarily the same as (right, left).
Name Type Description
left Boundary
right Boundary

next(boundary, unit){Boundary}

Moves the boundary forward by a unit measure.

The second parameter `unit` specifies the unit with which to move the
boundary. This value may be one of the following strings:

"char" -- Move in front of the next visible character.

"word" -- Move in front of the next word.

A word is the smallest semantic unit. It is a contigious sequence of
visible characters terminated by a space or puncuation character or
a word-breaker (in languages that do not use space to delimit word
boundaries).

"boundary" -- Move in front of the next boundary and skip over void
elements.

"offset" -- Move in front of the next visual offset.

A visual offset is the smallest unit of consumed space. This can be
a line break, or a visible character.

"node" -- Move in front of the next visible node.
Name Type Description
boundary Boundary
unit string optional Defaults to "offset"

prev(boundary, unit){Boundary}

Moves the boundary backwards by a unit measure.

The second parameter `unit` specifies the unit with which to move the
boundary. This value may be one of the following strings:

"char" -- Move behind the previous visible character.

"word" -- Move behind the previous word.

A word is the smallest semantic unit. It is a contigious sequence of
visible characters terminated by a space or puncuation character or
a word-breaker (in languages that do not use space to delimit word
boundaries).

"boundary" -- Move in behind of the previous boundary and skip over void
elements.

"offset" -- Move behind the previous visual offset.

A visual offset is the smallest unit of consumed space. This can be
a line break, or a visible character.

"node" -- Move in front of the previous visible node.
Name Type Description
boundary Boundary
unit string optional Defaults to "offset"
comments powered by Disqus