File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -247,9 +247,17 @@ $.fn.getSelectionStart = function(o)
247
247
{
248
248
if ( o . createTextRange )
249
249
{
250
- var r = document . selection . createRange ( ) . duplicate ( ) ;
251
- r . moveEnd ( 'character' , o . value . length ) ;
252
- if ( r . text === '' ) { return o . value . length ; }
250
+ var r ;
251
+ if ( typeof document . selection == "undefined" ) {
252
+ //On IE < 9 && IE >= 11 : "document.selection" is deprecated and you should use "document.getSelection()"
253
+ //https://github.com/SamWM/jQuery-Plugins/issues/62
254
+ r = document . getSelection ( ) ;
255
+ } else {
256
+ r = document . selection . createRange ( ) . duplicate ( ) ;
257
+ r . moveEnd ( 'character' , o . value . length ) ;
258
+ }
259
+ if ( r . text == '' ) return o . value . length ;
260
+
253
261
return o . value . lastIndexOf ( r . text ) ;
254
262
} else { return o . selectionStart ; }
255
263
} ;
You can’t perform that action at this time.
0 commit comments