File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -263,7 +263,10 @@ $.fn.getSelectionStart = function(o)
263263 if ( r . text == '' ) return o . value . length ;
264264
265265 return o . value . lastIndexOf ( r . text ) ;
266- } else { return o . selectionStart ; }
266+ } else {
267+ try { return o . selectionStart ; }
268+ catch ( e ) { return 0 ; }
269+ }
267270} ;
268271
269272// Based on code from http://javascript.nwbox.com/cursor_position/ (Diego Perini <dperini@nwbox.com>)
@@ -292,11 +295,16 @@ $.fn.setSelection = function(o, p)
292295 r . moveEnd ( 'character' , p [ 1 ] ) ;
293296 r . select ( ) ;
294297 }
295- else if ( o . setSelectionRange )
296- {
297- o . focus ( ) ;
298- o . setSelectionRange ( p [ 0 ] , p [ 1 ] ) ;
299- }
298+ else {
299+ o . focus ( ) ;
300+ try {
301+ if ( o . setSelectionRange )
302+ {
303+ o . setSelectionRange ( p [ 0 ] , p [ 1 ] ) ;
304+ }
305+ } catch ( e ) {
306+ }
307+ }
300308 }
301309} ;
302310
You can’t perform that action at this time.
0 commit comments