You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.
nsISelection
This interface allows for manipulating and querying the current selected range of nodes within the document. It is scriptable.
Returns the range at the specified index.
Syntax:
nsIDOMRange nsISelection::getRangeAt(in long index)Parameters:
Returns:
Collapses the selection to a single point, at the specified offset in the given DOM node. When the selection is collapsed, and the content is focused and editable, the caret will blink there.
Syntax:
void nsISelection::collapse(in nsIDOMNode parentNode, in long offset)Parameters:
nsresult:
Extends the selection by moving the focus to the specified node and offset, preserving the anchor postion. The new selection end result will always be from the anchor to the new focus, regardless of direction.
Syntax:
void nsISelection::extend(in nsIDOMNode parentNode, in long offset)Parameters:
nsresult:
Collapses the whole selection to a single point at the start of the current selection (no matter which direction). If content is focused and editable, the caret will blink there.
Syntax:
void nsISelection::collapseToStart()Parameters:
nsresult:
Collapses the whole selection to a single point at the end of the current selection (no matter which direction). If content is focused and editable, the caret will blink there.
Syntax:
void nsISelection::collapseToEnd()Parameters:
nsresult:
Determines whether or not a selection contains a particular node.
Syntax:
boolean nsISelection::containsNode(in nsIDOMNode node, in boolean entirelyContained)Parameters:
entirelyContained:
Whether or not the node must be entirely contained in the selection.PR_TRUE
indicates it must entirely contained.
Returns:
Adds all children of the specified node to the selection.
Syntax:
void nsISelection::selectAllChildren( in nsIDOMNode parentNode)Parameters:
nsresult:
Adds a range to the current selection.
Syntax:
void nsISelection::addRange(in nsIDOMRange range)Parameters:
nsresult:
Removes a range from the current selection.
Syntax:
void nsISelection::removeRange(in nsIDOMRange range)Parameters:
nsresult:
Removes all ranges from the current selection.
Syntax:
void nsISelection::removeAllRanges()Parameters:
nsresult:
Deletes this selection from the document to which the nodes belong.
Syntax:
void nsISelection::deleteFromDocument()Parameters:
nsresult:
Modifies the cursor Bidi level after a change in keyboard direction.
Syntax:
void nsISelection::selectionLanguageChange( in boolean langRTL)Parameters:
langRTL: PR_TRUE
if the new language is right-to-left orPR_FALSE
if the new language is left-to-right.
nsresult:
Returns the whole selection into a plain text string.
Syntax:
wstring nsISelection::toString()Parameters:
nsresult:
Gets the node representing one end of the selection.
Gets the offset within the (text) node where the selection begins.
Gets the node with keyboard focus.
Gets the offset within the (text) node where focus starts.
Written by:Ellen Evans | Comments, questions, complaints?
Bug 143387 |