@@ -341,7 +341,8 @@ the specific language governing permissions and limitations under the Apache Lic
341341 requestSequence = 0 , // sequence used to drop out-of-order responses
342342 handler = null ,
343343 quietMillis = options . quietMillis || 100 ,
344- ajaxUrl = options . url ;
344+ ajaxUrl = options . url ,
345+ self = this ;
345346
346347 return function ( query ) {
347348 window . clearTimeout ( timeout ) ;
@@ -354,14 +355,14 @@ the specific language governing permissions and limitations under the Apache Lic
354355 type = options . type || 'GET' , // set type of request (GET or POST)
355356 params = { } ;
356357
357- data = data ? data . call ( this , query . term , query . page , query . context ) : null ;
358- url = ( typeof url === 'function' ) ? url . call ( this , query . term , query . page , query . context ) : url ;
358+ data = data ? data . call ( self . opts . element , query . term , query . page , query . context ) : null ;
359+ url = ( typeof url === 'function' ) ? url . call ( self . opts . element , query . term , query . page , query . context ) : url ;
359360
360361 if ( null !== handler ) { handler . abort ( ) ; }
361362
362363 if ( options . params ) {
363364 if ( $ . isFunction ( options . params ) ) {
364- $ . extend ( params , options . params . call ( null ) ) ;
365+ $ . extend ( params , options . params . call ( self . opts . element ) ) ;
365366 } else {
366367 $ . extend ( params , options . params ) ;
367368 }
@@ -382,7 +383,7 @@ the specific language governing permissions and limitations under the Apache Lic
382383 query . callback ( results ) ;
383384 }
384385 } ) ;
385- handler = transport . call ( null , params ) ;
386+ handler = transport . call ( self . opts . element , params ) ;
386387 } , quietMillis ) ;
387388 } ;
388389 }
0 commit comments