File tree Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Original file line number Diff line number Diff line change 16
16
*/
17
17
( function ( $ , undefined ) {
18
18
19
- // used to prevent race conditions with remote data sources
20
- var requestIndex = 0 ;
21
-
22
19
$ . widget ( "ui.autocomplete" , {
23
20
version : "@VERSION" ,
24
21
defaultElement : "<input>" ,
@@ -416,21 +413,24 @@ $.widget( "ui.autocomplete", {
416
413
this . source ( { term : value } , this . _response ( ) ) ;
417
414
} ,
418
415
419
- _response : function ( ) {
420
- var that = this ,
421
- index = ++ requestIndex ;
416
+ _response : ( function ( ) {
417
+ var requestIndex = 0 ;
422
418
423
- return function ( content ) {
424
- if ( index === requestIndex ) {
425
- that . __response ( content ) ;
426
- }
419
+ return function ( ) {
420
+ var index = ++ requestIndex ;
427
421
428
- that . pending -- ;
429
- if ( ! that . pending ) {
430
- that . element . removeClass ( "ui-autocomplete-loading" ) ;
431
- }
422
+ return $ . proxy ( function ( content ) {
423
+ if ( index === requestIndex ) {
424
+ this . __response ( content ) ;
425
+ }
426
+
427
+ this . pending -- ;
428
+ if ( ! this . pending ) {
429
+ this . element . removeClass ( "ui-autocomplete-loading" ) ;
430
+ }
431
+ } , this ) ;
432
432
} ;
433
- } ,
433
+ } ) ( ) ,
434
434
435
435
__response : function ( content ) {
436
436
if ( content ) {
You can’t perform that action at this time.
0 commit comments