nsISelection
| IID: | B2C7ED59-8634-4352-9E37-5484C8B6E4E1 |
| Inherits From: | nsISupports |
| Status: | FROZEN |
Interface for manipulating and querying the current selected range of nodes within the document.
Properties
readonly nsIDOMNode anchorNode
Returns the node in which the selection begins.
readonly PRInt32 anchorOffset
The offset within the (text) node where the selection begins.
readonly nsIDOMNode focusNode
Returns the node in which the selection ends.
readonly PRInt32 focusOffset
The offset within the (text) node where the selection ends.
readonly PRBool isCollapsed
Indicates if the selection is collapsed or not.
readonly PRInt32 rangeCount
Returns the number of ranges in the selection.
Methods
void addRange ( nsIDOMRange range )
void collapse ( nsIDOMNode parentNode , PRInt32 offset )
void collapseToEnd ( )
void collapseToStart ( )
PRBool containsNode ( nsIDOMNode node , PRBool partlyContained )
void deleteFromDocument ( )
void extend ( nsIDOMNode parentNode , PRInt32 offset )
nsIDOMRange getRangeAt ( PRInt32 index )
void removeAllRanges ( )
void removeRange ( nsIDOMRange range )
void selectAllChildren ( nsIDOMNode parentNode )
void selectionLanguageChange ( PRBool langRTL )
PRUnichar* toString ( )
void collapse ( nsIDOMNode parentNode , PRInt32 offset )
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.
- Arguments:
- parentNode: The given dom node where the selection will be set
- offset: Where in given dom node to place the selection (the offset into the given node)
Collapses the whole selection to a single point at the end of the current selection (irrespective of direction). If content is focused and editable, the caret will blink there.
Collapses the whole selection to a single point at the start of the current selection (irrespective of direction). If content is focused and editable, the caret will blink there.
PRBool containsNode ( nsIDOMNode node , PRBool partlyContained )
Indicates whether the node is part of the selection. If partlyContained is set to PR_TRUE, the function returns true when some part of the node is part of the selection. If partlyContained is set to PR_FALSE, the function only returns true when the entire node is part of the selection.
- Arguments:
- node
- partlyContained
void extend ( nsIDOMNode parentNode , PRInt32 offset )
Extends the selection by moving the selection end to the specified node and offset, preserving the selection begin position. The new selection end result will always be from the anchorNode to the new focusNode, regardless of direction.
- Arguments:
- parentNode: The node where the selection will be extended to
- offset: Where in node to place the offset in the new selection end
void selectAllChildren ( nsIDOMNode parentNode )
Adds all children of the specified node to the selection.
- Arguments:
- parentNode: the parent of the children to be added to the selection.
void selectionLanguageChange ( PRBool langRTL )
Modifies the cursor Bidi level after a change in keyboard direction
- Arguments:
- langRTL: is PR_TRUE if the new language is right-to-left or PR_FALSE if the new language is left-to-right.
References
This interface is the type of the following properties:
This interface is passed as an argument to the following methods:
nsIDocumentEncoder.setSelection, nsIDragService.invokeDragSessionWithSelection, nsIEditActionListener.DidDeleteSelection, nsIEditActionListener.WillDeleteSelection, nsIHTMLEditor.checkSelectionStateForAnonymousButtons, nsIInlineSpellChecker.spellCheckAfterEditorChange, nsISelectionListener.notifySelectionChanged
This interface is returned from the following methods:
nsIDOMWindow.getSelection, nsISelectionController.getSelection
Reference documentation is generated from Mozilla's source.
