Selection

Availability

BlackBerry Device Software version 4.7.1 or later

The Selection object contains one or more Range objects.

Properties

Property name

Type

Description

Status

Support level

Availability

anchorNode

Node

Returns the node in which the selection begins.

read-only

Not part of any standard.

4.7.1 or later

anchorOffset

int

Returns the number of characters within the anchorNode that the selection begins.

read-only

Not part of any standard.

4.7.1 or later

focusNode

Node

Returns the node in which the selection ends.

read-only

Not part of any standard.

4.7.1 or later

focusOffset

int

Returns the number of characters within the focusNode that the selection ends.

read-only

Not part of any standard.

4.7.1 or later

isCollapsed

boolean

Returns true if the start point and end point of the selection are at the same position; returns false if they are not.

read-only

Not part of any standard.

4.7.1 or later

rangeCount

int

Returns the number of Range objects contained by the Selection object.

read-only

Not part of any standard.

4.7.1 or later

Methods

Method name

Description

Support level

Availability

addRange()

Adds a Range object to the selection.

Not part of any standard.

4.7.1 or later

collapse()

Collapses a selection onto a single boundary point.

Not part of any standard.

4.7.1 or later

collapseToEnd()

Moves the anchor of the selection to the same point as the focus.

Not part of any standard.

4.7.1 or later

collapseToStart()

Moves the focus of the selection to the same point as the anchor.

Not part of any standard.

4.7.1 or later

deleteFromDocument()

Deletes the text contained within the selection from the Document object.

Not part of any standard.

4.7.1 or later

getRangeAt()

Returns a Range object that is present in the selection.

Not part of any standard.

4.7.1 or later

removeRange()

Removes the specified Range object from the selection.

Not part of any standard.

4.7.1 or later

removeAllRanges()

Removes all Range objects from the selection.

Not part of any standard.

4.7.1 or later

selectAllChildren()

Adds all the child nodes of a specified node to the selection.

Not part of any standard.

4.7.1 or later

Last modified: 2014-03-10



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus