Selection
Module: JavaScript DOM API
The navigator of the view.
#include <Selection.idl>
Public Functions
Name | |
---|---|
void | removeAllRanges() Removes all ranges from the selection. |
void | empty() Clear the selection. This is an alias for removeAllRanges(). |
void | setBaseAndExtent(Node anchorNode, unsigned long anchorOffset, Node focusNode, unsigned long focusOffset) Sets the selection to be a range including all or parts of two specified DOM nodes, and any content located between them. |
DOMString | toString() Returns a string currently being represented by the selection object, i.e. the currently selected text. |
Public Attributes
Name | |
---|---|
readonly attribute Node | anchorNode Returns the Node in which the selection begins. Can return null if selection never existed in the document. |
readonly attribute unsigned long | anchorOffset Returns a number representing the offset of the selection’s anchor within the anchorNode. |
readonly attribute Node | focusNode Returns the Node in which the selection ends. Can return null if selection never existed in the document. |
readonly attribute unsigned long | focusOffset Returns a number representing the offset of the selection’s anchor within the focusNode. |
Public Functions Documentation
function removeAllRanges
void removeAllRanges()
Removes all ranges from the selection.
function empty
void empty()
Clear the selection. This is an alias for removeAllRanges().
function setBaseAndExtent
void setBaseAndExtent(
Node anchorNode,
unsigned long anchorOffset,
Node focusNode,
unsigned long focusOffset
)
Sets the selection to be a range including all or parts of two specified DOM nodes, and any content located between them.
function toString
DOMString toString()
Returns a string currently being represented by the selection object, i.e. the currently selected text.
Public Attributes Documentation
variable anchorNode
readonly attribute Node anchorNode;
Returns the Node in which the selection begins. Can return null if selection never existed in the document.
variable anchorOffset
readonly attribute unsigned long anchorOffset;
Returns a number representing the offset of the selection’s anchor within the anchorNode.
variable focusNode
readonly attribute Node focusNode;
Returns the Node in which the selection ends. Can return null if selection never existed in the document.
variable focusOffset
readonly attribute unsigned long focusOffset;
Returns a number representing the offset of the selection’s anchor within the focusNode.