Selection
The Selection API controls and modifies user text selections within the page. To learn more, see AbstractRange, AbstractRange: collapsed property, AbstractRange: endContainer property, AbstractRange: endOffset property, AbstractRange: startContainer property, AbstractRange: startOffset property, Document: createRange() method, Document: getSelection() method, Document: selectionchange event, HTMLInputElement: selectionchange event, HTMLTextAreaElement: selectionchange event, Node: selectstart event, Range, Range: Range() constructor, Range: cloneContents() method, Range: cloneRange() method, Range: collapse() method, Range: collapsed property, Range: commonAncestorContainer property, Range: compareBoundaryPoints() method, Range: comparePoint() method, Range: deleteContents() method, Range: detach() method, Range: endContainer property, Range: endOffset property, Range: extractContents() method, Range: insertNode() method, Range: intersectsNode() method, Range: isPointInRange() method, Range: selectNode() method, Range: selectNodeContents() method, Range: setEnd() method, Range: setEndAfter() method, Range: setEndBefore() method, Range: setStart() method, Range: setStartAfter() method, Range: setStartBefore() method, Range: startContainer property, Range: startOffset property, Range: surroundContents() method, Range: toString() method, Selection, Selection: addRange() method, Selection: anchorNode property, Selection: anchorOffset property, Selection: collapse() method, Selection: collapseToEnd() method, Selection: collapseToStart() method, Selection: containsNode() method, Selection: deleteFromDocument() method, Selection: direction property, Selection: empty() method, Selection: extend() method, Selection: focusNode property, Selection: focusOffset property, Selection: getRangeAt() method, Selection: isCollapsed property, Selection: modify() method, Selection: rangeCount property, Selection: removeAllRanges() method, Selection: removeRange() method, Selection: selectAllChildren() method, Selection: setBaseAndExtent() method, Selection: setPosition() method, Selection: toString() method, Selection: type property, StaticRange, StaticRange: StaticRange() constructor, StaticRange: collapsed property, StaticRange: endContainer property, StaticRange: endOffset property, StaticRange: startContainer property, StaticRange: startOffset property, Window: getSelection() method at MDN.
Compatibility (view on caniuse.com)
- Chrome 11 Released on 2011-04-27
- Chrome Android 18 Released on 2012-06-27
- Edge 12 Released on 2015-07-29
- Firefox 52 Released on 2017-03-07
- Firefox for Android 52 Released on 2017-03-07
- Safari 5.1 Released on 2011-07-20
- Safari on iOS 5 Released on 2011-10-12
Specifications
- Selection API, from Web Editing Working Group (W3C).