Calling the Selection.toString()
method returns the text contained in the selection, e.g.:
Documentation Selection by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See:
Variables
read onlyanchorOffset:Int
Returns a number representing the offset of the selection's anchor within the anchorNode. If anchorNode is a text node, this is the number of characters within anchorNode preceding the anchor. If anchorNode is an element, this is the number of child nodes of the anchorNode preceding the anchor.
read onlyfocusOffset:Int
Returns a number representing the offset of the selection's anchor within the focusNode. If focusNode is a text node, this is the number of characters within focusNode preceding the focus. If focusNode is an element, this is the number of child nodes of the focusNode preceding the focus.
read onlyisCollapsed:Bool
Returns a Boolean indicating whether the selection's start and end points are at the same position.