NAME
Mozilla::DOM::Selection
Mozilla::DOM::Selection is a wrapper around an instance of Mozilla's nsISelection interface. This class inherits from Supports.
* Interface for manipulating and querying the current selected range
* of nodes within the document.
CLASS METHODS
$iid = Mozilla::DOM::Selection->GetIID()
Pass this to QueryInterface.
METHODS
$selection->AddRange($range)
$range (Mozilla::DOM::Range)
* Adds a range to the current selection.
$selection->Collapse($parentNode, $offset)
$parentNode (Mozilla::DOM::Node)
$offset (integer (long))
* 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.
*
* @param parentNode The given dom node where the selection will be set
* @param offset Where in given dom node to place the selection
(the offset into the given node)
$selection->CollapseToStart()
* 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.
$selection->CollapseToEnd()
* 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.
$bool = $selection->ContainsNode($node, $entirelyContained)
$node (Mozilla::DOM::Node)
$entirelyContained (boolean)
* The value of entirelyContained determines the detail of the search to determine if
* the selection contains the node. If entirelyContained is set to PR_TRUE, t
* or false if
*
* @param node The node where the selection will be extended to
* @param entirelyContained Whether
$selection->DeleteFromDocument()
* Deletes this selection from document the nodes belong to.
$selection->Extend($parentNode, $offset)
$parentNode (Mozilla::DOM::Node)
$offset (integer (long))
* 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.
*
* @param parentNode The node where the selection will be extended to
* @param offset Where in node to place the offset in the new focused node
$node = $selection->GetAnchorNode()
* The node representing one end of the selection.
$offset = $selection->GetAnchorOffset()
* The offset within the (text) node where the selection begins.
$node = $selection->GetFocusNode()
* The node with keyboard focus.
$offset = $selection->GetFocusOffset()
* The offset within the (text) node where focus starts.
$bool = $selection->GetIsCollapsed()
* Indicates if the selection is collapsed or not.
$range = $selection->GetRangeAt($index)
$index (integer (long))
* Returns the range at the specified index.
$count = $selection->GetRangeCount()
* Returns the number of ranges in the selection.
$selection->RemoveAllRanges()
* Removes all ranges from the current selection.
$selection->RemoveRange($range)
$range (Mozilla::DOM::Range)
* Removes a range from the current selection.
$selection->SelectAllChildren($parentnode)
$parentNode (Mozilla::DOM::Node)
* Adds all children of the specified node to the selection.
*
* @param parentNode the parent of the children to be added to the selection.
$selection->SelectionLanguageChange($langRTL)
$langRTL (boolean)
* Modifies the cursor Bidi level after a change in keyboard direction
*
* @param langRTL is PR_TRUE if the new language is right-to-left or
* PR_FALSE if the new language is left-to-right.
$str = $selection->ToString()
Returns the whole selection into a plain text string. Note: only the text, not the markup. (DAMN!)
SEE ALSO
COPYRIGHT
Copyright (C) 2005-2007, Scott Lanning
This software is licensed under the LGPL. See Mozilla::DOM for a full notice.