Class: SC.TextSelection

Extends SC.Copyable, SC.Freezable, SC.Object.

A simple object representing the selection inside a text field. Each object is frozen and contains exactly three properties: start end length

Important note: In Internet Explorer, newlines in textarea elements are considered two characters. SproutCore does not currently try to hide this from you.

Defined in: text_selection.js

SproutCore 1.0

Field Summary

Instance Methods

Field Detail


The direction of the selection. Currently only supported on Chrome, Firefox, and Safari >= 6.

Possible values are 'none' 'forward' 'backward'

Default value:

The number of characters appearing to the left of the end of the selection.

This will have the same value as 'start' if there is no selection and instead there is only a caret.


The number of characters appearing to the left of the beginning of the selection, starting at 0.

Instance Method Detail


The length of the selection. This is equivalent to (end - start) and exists mainly as a convenience.

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:21 GMT-0600 (CST)