Home

# Library goog.dom.selection

Function Summary
| `canonicalizePositionIe_(?Element textfield, number pos) ⇒ number` Helper function for canonicalizing a position inside a textfield in IE. Deals with the issue that \r\n counts as 2 characters, but move('character', n) passes over both characters in one move.
| `getEnd(?Element textfield) ⇒ number` Returns the place where the selection ends inside a textarea or a text input
| `getEndPoints(?Element textfield) ⇒ ?Array.<number>` Returns the start and end points of the selection inside a textarea or a text input.
| `getEndPointsTextareaIe_(?TextRange range, ?TextRange selRange, boolean getOnlyStart) ⇒ ?Array.<number>` Returns the start and end points of the selection within a textarea in IE. IE treats newline characters as \r\n characters, and we need to check for these characters at the edge of our selection, to ensure that we return the right cursor position.
| `getEndPoints_(?Element textfield, boolean getOnlyStart) ⇒ ?Array.<number>` Returns the start and end points of the selection inside a textarea or a text input.
| `getRangeIe_(?Element el) ⇒ ?Array` Helper function for returning the range for an object as well as the selection range
| `getSelectionRangeText_(?TextRange selRange) ⇒ string` Returns the selected text within a textarea in IE. IE treats newline characters as \r\n characters, and we need to check for these characters at the edge of our selection, to ensure that we return the right string.
| `getStart(?Element textfield) ⇒ number` Return the place where the selection starts inside a textarea or a text input
| `getText(?Element textfield) ⇒ string` Returns the selected text inside a textarea or a text input
| `setCursorPosition(?Element textfield, number pos)` Sets the cursor position within a textfield.
| `setEnd(?Element textfield, number pos)` Sets the place where the selection should end inside a text area or a text input
| `setStart(?Element textfield, number pos)` Sets the place where the selection should start inside a textarea or a text input
| `setText(?Element textfield, string text)` Sets the selected text inside a textarea or a text input
| `useSelectionProperties_(?Element el) ⇒ boolean` Helper function to determine whether it's okay to use selectionStart/selectionEnd.