This tests onSelect for textareas. This also makes sure that the correct selection is restored when the element regains focus. Calling focus on textarea After focus: textarea selection start: 0 end: 0 Calling setSelectionRange on textarea After setSelectionRange(5, 10): textarea selection start: 5 end: 10 Double clicking to make selection for textarea onselect fired for textarea After double clicking: textarea selection start: 9 end: 13 Calling blur on textarea After blur: textarea selection start: 9 end: 13 Calling focus on textarea After focus: textarea selection start: 9 end: 13