@types/jquery 2.0.66 → 2.0.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
jquery v2.0/index.d.ts CHANGED
@@ -13,11 +13,12 @@ See the Apache Version 2.0 License for specific language governing permissions
13
13
  and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
+ type BoundFunction = (this: HTMLElement) => void;
16
17
  /**
17
18
  * Interface for the AJAX setting that will configure the AJAX request
18
19
  * @see {@link https://api.jquery.com/jQuery.ajax/#jQuery-ajax-settings}
19
20
  */
20
- interface JQueryAjaxSettings {
21
+ interface JQueryBaseSettings<Context = any> {
21
22
  /**
22
23
  * The content type sent in the request header that tells the server what kind of response it will accept in return. If the accepts setting needs modification, it is recommended to do so once in the $.ajaxSetup() method.
23
24
  */
@@ -29,7 +30,7 @@ interface JQueryAjaxSettings {
29
30
  /**
30
31
  * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless of the type of request.
31
32
  */
32
- beforeSend?(jqXHR: JQueryXHR, settings: JQueryAjaxSettings): any;
33
+ beforeSend?(jqXHR: JQueryXHR<Context>, settings: JQueryAjaxSettings<Context>): any;
33
34
  /**
34
35
  * If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET.
35
36
  */
@@ -37,7 +38,7 @@ interface JQueryAjaxSettings {
37
38
  /**
38
39
  * A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request ("success", "notmodified", "error", "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event.
39
40
  */
40
- complete?(jqXHR: JQueryXHR, textStatus: string): any;
41
+ complete?(jqXHR: JQueryXHR<Context>, textStatus: string): any;
41
42
  /**
42
43
  * An object of string/regular-expression pairs that determine how jQuery will parse the response, given its content type. (version added: 1.5)
43
44
  */
@@ -48,10 +49,6 @@ interface JQueryAjaxSettings {
48
49
  * When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding.
49
50
  */
50
51
  contentType?: any;
51
- /**
52
- * This object will be made the context of all Ajax-related callbacks. By default, the context is an object that represents the ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax).
53
- */
54
- context?: any;
55
52
  /**
56
53
  * An object containing dataType-to-dataType converters. Each converter's value is a function that returns the transformed value of the response. (version added: 1.5)
57
54
  */
@@ -75,7 +72,7 @@ interface JQueryAjaxSettings {
75
72
  /**
76
73
  * A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event.
77
74
  */
78
- error?(jqXHR: JQueryXHR, textStatus: string, errorThrown: string): any;
75
+ error?(jqXHR: JQueryXHR<Context>, textStatus: string, errorThrown: string): any;
79
76
  /**
80
77
  * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events.
81
78
  */
@@ -127,7 +124,7 @@ interface JQueryAjaxSettings {
127
124
  /**
128
125
  * A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event.
129
126
  */
130
- success?(data: any, textStatus: string, jqXHR: JQueryXHR): any;
127
+ success?(data: any, textStatus: string, jqXHR: JQueryXHR<Context>): any;
131
128
  /**
132
129
  * Set a timeout (in milliseconds) for the request. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period.
133
130
  */
@@ -158,11 +155,18 @@ interface JQueryAjaxSettings {
158
155
  xhrFields?: { [key: string]: any } | undefined;
159
156
  }
160
157
 
158
+ interface JQueryAjaxSettings<Context = JQueryBaseSettings> extends JQueryBaseSettings<Context> {
159
+ /**
160
+ * This object will be made the context of all Ajax-related callbacks. By default, the context is an object that represents the ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax).
161
+ */
162
+ context?: Context;
163
+ }
164
+
161
165
  /**
162
166
  * Interface for the jqXHR object
163
167
  * @see {@link https://api.jquery.com/jQuery.ajax/#jqXHR}
164
168
  */
165
- interface JQueryXHR extends XMLHttpRequest, JQueryPromise<any> {
169
+ interface JQueryXHR<C = any> extends XMLHttpRequest, JQueryPromise<any, C> {
166
170
  /**
167
171
  * The .overrideMimeType() method may be used in the beforeSend() callback function, for example, to modify the response content-type header. As of jQuery 1.5.1, the jqXHR object also contains the overrideMimeType() method (it was available in jQuery 1.4.x, as well, but was temporarily removed in jQuery 1.5).
168
172
  */
@@ -177,9 +181,9 @@ interface JQueryXHR extends XMLHttpRequest, JQueryPromise<any> {
177
181
  * Incorporates the functionality of the .done() and .fail() methods, allowing (as of jQuery 1.8) the underlying Promise to be manipulated. Refer to deferred.then() for implementation details.
178
182
  */
179
183
  then<R>(
180
- doneCallback: (data: any, textStatus: string, jqXHR: JQueryXHR) => R | JQueryPromise<R>,
181
- failCallback?: (jqXHR: JQueryXHR, textStatus: string, errorThrown: any) => void,
182
- ): JQueryPromise<R>;
184
+ doneCallback: (data: any, textStatus: string, jqXHR: JQueryXHR<C>) => R | JQueryPromise<R, C>,
185
+ failCallback?: (jqXHR: JQueryXHR<C>, textStatus: string, errorThrown: any) => void,
186
+ ): JQueryPromise<R, C>;
183
187
  /**
184
188
  * Property containing the parsed response if the response content type is json
185
189
  */
@@ -187,7 +191,7 @@ interface JQueryXHR extends XMLHttpRequest, JQueryPromise<any> {
187
191
  /**
188
192
  * A function to be called if the request fails.
189
193
  */
190
- error(xhr: JQueryXHR, textStatus: string, errorThrown: string): void;
194
+ error(xhr: JQueryXHR<C>, textStatus: string, errorThrown: string): void;
191
195
  }
192
196
 
193
197
  /**
@@ -290,7 +294,7 @@ interface JQueryCallback {
290
294
  /**
291
295
  * Allows jQuery Promises to interop with non-jQuery promises
292
296
  */
293
- interface JQueryGenericPromise<T> {
297
+ interface JQueryGenericPromise<T, C = any> {
294
298
  /**
295
299
  * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
296
300
  *
@@ -299,10 +303,10 @@ interface JQueryGenericPromise<T> {
299
303
  * @see {@link https://api.jquery.com/deferred.then/#deferred-then-doneFilter-failFilter-progressFilter}
300
304
  */
301
305
  then<U>(
302
- doneFilter: (value?: T, ...values: any[]) => U | JQueryPromise<U>,
306
+ doneFilter: (value?: T, ...values: any[]) => U | JQueryPromise<U, C>,
303
307
  failFilter?: (...reasons: any[]) => any,
304
308
  progressFilter?: (...progression: any[]) => any,
305
- ): JQueryPromise<U>;
309
+ ): JQueryPromise<U, C>;
306
310
 
307
311
  /**
308
312
  * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
@@ -315,28 +319,28 @@ interface JQueryGenericPromise<T> {
315
319
  doneFilter: (value?: T, ...values: any[]) => void,
316
320
  failFilter?: (...reasons: any[]) => any,
317
321
  progressFilter?: (...progression: any[]) => any,
318
- ): JQueryPromise<void>;
322
+ ): JQueryPromise<void, C>;
319
323
  }
320
324
 
321
325
  /**
322
326
  * Interface for the JQuery promise/deferred callbacks
323
327
  */
324
- interface JQueryPromiseCallback<T> {
325
- (value?: T, ...args: any[]): void;
328
+ interface JQueryPromiseCallback<T, C = any> {
329
+ (this: C, value?: T, ...args: any[]): void;
326
330
  }
327
331
 
328
- interface JQueryPromiseOperator<T, U> {
332
+ interface JQueryPromiseOperator<T, U, C = any> {
329
333
  (
330
- callback1: JQueryPromiseCallback<T> | Array<JQueryPromiseCallback<T>>,
331
- ...callbacksN: Array<JQueryPromiseCallback<any> | Array<JQueryPromiseCallback<any>>>
332
- ): JQueryPromise<U>;
334
+ callback1: JQueryPromiseCallback<T, C> | Array<JQueryPromiseCallback<T, C>>,
335
+ ...callbacksN: Array<JQueryPromiseCallback<any, C> | Array<JQueryPromiseCallback<any, C>>>
336
+ ): JQueryPromise<U, C>;
333
337
  }
334
338
 
335
339
  /**
336
340
  * Interface for the JQuery promise, part of callbacks
337
341
  * @see {@link https://api.jquery.com/category/deferred-object/}
338
342
  */
339
- interface JQueryPromise<T> extends JQueryGenericPromise<T> {
343
+ interface JQueryPromise<T, C = any> extends JQueryGenericPromise<T, C> {
340
344
  /**
341
345
  * Determine the current state of a Deferred object.
342
346
  * @see {@link https://api.jquery.com/deferred.state/}
@@ -350,9 +354,9 @@ interface JQueryPromise<T> extends JQueryGenericPromise<T> {
350
354
  * @see {@link https://api.jquery.com/deferred.always/}
351
355
  */
352
356
  always(
353
- alwaysCallback1?: JQueryPromiseCallback<any> | Array<JQueryPromiseCallback<any>>,
357
+ alwaysCallback1?: JQueryPromiseCallback<any, C> | Array<JQueryPromiseCallback<any, C>>,
354
358
  ...alwaysCallbackN: Array<JQueryPromiseCallback<any> | Array<JQueryPromiseCallback<any>>>
355
- ): JQueryPromise<T>;
359
+ ): JQueryPromise<T, C>;
356
360
  /**
357
361
  * Add handlers to be called when the Deferred object is resolved.
358
362
  *
@@ -361,9 +365,9 @@ interface JQueryPromise<T> extends JQueryGenericPromise<T> {
361
365
  * @see {@link https://api.jquery.com/deferred.done/}
362
366
  */
363
367
  done(
364
- doneCallback1?: JQueryPromiseCallback<T> | Array<JQueryPromiseCallback<T>>,
365
- ...doneCallbackN: Array<JQueryPromiseCallback<T> | Array<JQueryPromiseCallback<T>>>
366
- ): JQueryPromise<T>;
368
+ doneCallback1?: JQueryPromiseCallback<T, C> | Array<JQueryPromiseCallback<T, C>>,
369
+ ...doneCallbackN: Array<JQueryPromiseCallback<T, C> | Array<JQueryPromiseCallback<T, C>>>
370
+ ): JQueryPromise<T, C>;
367
371
  /**
368
372
  * Add handlers to be called when the Deferred object is rejected.
369
373
  *
@@ -372,9 +376,9 @@ interface JQueryPromise<T> extends JQueryGenericPromise<T> {
372
376
  * @see {@link https://api.jquery.com/deferred.fail/}
373
377
  */
374
378
  fail(
375
- failCallback1?: JQueryPromiseCallback<any> | Array<JQueryPromiseCallback<any>>,
376
- ...failCallbackN: Array<JQueryPromiseCallback<any> | Array<JQueryPromiseCallback<any>>>
377
- ): JQueryPromise<T>;
379
+ failCallback1?: JQueryPromiseCallback<any, C> | Array<JQueryPromiseCallback<any, C>>,
380
+ ...failCallbackN: Array<JQueryPromiseCallback<any, C> | Array<JQueryPromiseCallback<any, C>>>
381
+ ): JQueryPromise<T, C>;
378
382
  /**
379
383
  * Add handlers to be called when the Deferred object generates progress notifications.
380
384
  *
@@ -383,16 +387,16 @@ interface JQueryPromise<T> extends JQueryGenericPromise<T> {
383
387
  * @see {@link https://api.jquery.com/deferred.progress/}
384
388
  */
385
389
  progress(
386
- progressCallback1?: JQueryPromiseCallback<any> | Array<JQueryPromiseCallback<any>>,
387
- ...progressCallbackN: Array<JQueryPromiseCallback<any> | Array<JQueryPromiseCallback<any>>>
388
- ): JQueryPromise<T>;
390
+ progressCallback1?: JQueryPromiseCallback<any, C> | Array<JQueryPromiseCallback<any, C>>,
391
+ ...progressCallbackN: Array<JQueryPromiseCallback<any, C> | Array<JQueryPromiseCallback<any, C>>>
392
+ ): JQueryPromise<T, C>;
389
393
 
390
394
  // Deprecated - given no typings
391
395
  pipe(
392
396
  doneFilter?: (x: any) => any,
393
397
  failFilter?: (x: any) => any,
394
398
  progressFilter?: (x: any) => any,
395
- ): JQueryPromise<any>;
399
+ ): JQueryPromise<any, C>;
396
400
 
397
401
  /**
398
402
  * Return a Deferred's Promise object.
@@ -400,14 +404,14 @@ interface JQueryPromise<T> extends JQueryGenericPromise<T> {
400
404
  * @param target Object onto which the promise methods have to be attached
401
405
  * @see {@link https://api.jquery.com/deferred.promise/}
402
406
  */
403
- promise(target?: any): JQueryPromise<T>;
407
+ promise(target?: any): JQueryPromise<T, C>;
404
408
  }
405
409
 
406
410
  /**
407
411
  * Interface for the JQuery deferred, part of callbacks
408
412
  * @see {@link https://api.jquery.com/category/deferred-object/}
409
413
  */
410
- interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
414
+ interface JQueryDeferred<T, C = any> extends JQueryGenericPromise<T, C> {
411
415
  /**
412
416
  * Determine the current state of a Deferred object.
413
417
  * @see {@link https://api.jquery.com/deferred.state/}
@@ -421,9 +425,9 @@ interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
421
425
  * @see {@link https://api.jquery.com/deferred.always/}
422
426
  */
423
427
  always(
424
- alwaysCallback1?: JQueryPromiseCallback<any> | Array<JQueryPromiseCallback<any>>,
425
- ...alwaysCallbackN: Array<JQueryPromiseCallback<any> | Array<JQueryPromiseCallback<any>>>
426
- ): JQueryDeferred<T>;
428
+ alwaysCallback1?: JQueryPromiseCallback<any, C> | Array<JQueryPromiseCallback<any, C>>,
429
+ ...alwaysCallbackN: Array<JQueryPromiseCallback<any, C> | Array<JQueryPromiseCallback<any, C>>>
430
+ ): JQueryDeferred<T, C>;
427
431
  /**
428
432
  * Add handlers to be called when the Deferred object is resolved.
429
433
  *
@@ -432,9 +436,9 @@ interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
432
436
  * @see {@link https://api.jquery.com/deferred.done/}
433
437
  */
434
438
  done(
435
- doneCallback1?: JQueryPromiseCallback<T> | Array<JQueryPromiseCallback<T>>,
436
- ...doneCallbackN: Array<JQueryPromiseCallback<T> | Array<JQueryPromiseCallback<T>>>
437
- ): JQueryDeferred<T>;
439
+ doneCallback1?: JQueryPromiseCallback<T, C> | Array<JQueryPromiseCallback<T, C>>,
440
+ ...doneCallbackN: Array<JQueryPromiseCallback<T, C> | Array<JQueryPromiseCallback<T, C>>>
441
+ ): JQueryDeferred<T, C>;
438
442
  /**
439
443
  * Add handlers to be called when the Deferred object is rejected.
440
444
  *
@@ -443,9 +447,9 @@ interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
443
447
  * @see {@link https://api.jquery.com/deferred.fail/}
444
448
  */
445
449
  fail(
446
- failCallback1?: JQueryPromiseCallback<any> | Array<JQueryPromiseCallback<any>>,
447
- ...failCallbackN: Array<JQueryPromiseCallback<any> | Array<JQueryPromiseCallback<any>>>
448
- ): JQueryDeferred<T>;
450
+ failCallback1?: JQueryPromiseCallback<any, C> | Array<JQueryPromiseCallback<any, C>>,
451
+ ...failCallbackN: Array<JQueryPromiseCallback<any, C> | Array<JQueryPromiseCallback<any, C>>>
452
+ ): JQueryDeferred<T, C>;
449
453
  /**
450
454
  * Add handlers to be called when the Deferred object generates progress notifications.
451
455
  *
@@ -454,9 +458,9 @@ interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
454
458
  * @see {@link https://api.jquery.com/deferred.progress/}
455
459
  */
456
460
  progress(
457
- progressCallback1?: JQueryPromiseCallback<any> | Array<JQueryPromiseCallback<any>>,
458
- ...progressCallbackN: Array<JQueryPromiseCallback<any> | Array<JQueryPromiseCallback<any>>>
459
- ): JQueryDeferred<T>;
461
+ progressCallback1?: JQueryPromiseCallback<any, C> | Array<JQueryPromiseCallback<any, C>>,
462
+ ...progressCallbackN: Array<JQueryPromiseCallback<any, C> | Array<JQueryPromiseCallback<any, C>>>
463
+ ): JQueryDeferred<T, C>;
460
464
 
461
465
  /**
462
466
  * Call the progressCallbacks on a Deferred object with the given args.
@@ -464,7 +468,7 @@ interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
464
468
  * @param args Optional arguments that are passed to the progressCallbacks.
465
469
  * @see {@link https://api.jquery.com/deferred.notify/}
466
470
  */
467
- notify(value?: any, ...args: any[]): JQueryDeferred<T>;
471
+ notify(value?: any, ...args: any[]): JQueryDeferred<T, C>;
468
472
 
469
473
  /**
470
474
  * Call the progressCallbacks on a Deferred object with the given context and args.
@@ -473,7 +477,7 @@ interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
473
477
  * @param args Optional arguments that are passed to the progressCallbacks.
474
478
  * @see {@link https://api.jquery.com/deferred.notifyWith/}
475
479
  */
476
- notifyWith(context: any, args?: any[]): JQueryDeferred<T>;
480
+ notifyWith<Context = any>(context: Context, args?: any[]): JQueryDeferred<T, Context>;
477
481
 
478
482
  /**
479
483
  * Reject a Deferred object and call any failCallbacks with the given args.
@@ -481,7 +485,7 @@ interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
481
485
  * @param args Optional arguments that are passed to the failCallbacks.
482
486
  * @see {@link https://api.jquery.com/deferred.reject/}
483
487
  */
484
- reject(value?: any, ...args: any[]): JQueryDeferred<T>;
488
+ reject(value?: any, ...args: any[]): JQueryDeferred<T, C>;
485
489
  /**
486
490
  * Reject a Deferred object and call any failCallbacks with the given context and args.
487
491
  *
@@ -489,7 +493,7 @@ interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
489
493
  * @param args An optional array of arguments that are passed to the failCallbacks.
490
494
  * @see {@link https://api.jquery.com/deferred.rejectWith/}
491
495
  */
492
- rejectWith(context: any, args?: any[]): JQueryDeferred<T>;
496
+ rejectWith<Context = any>(context: Context, args?: any[]): JQueryDeferred<T, Context>;
493
497
 
494
498
  /**
495
499
  * Resolve a Deferred object and call any doneCallbacks with the given args.
@@ -498,7 +502,7 @@ interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
498
502
  * @param args Optional subsequent arguments that are passed to the doneCallbacks.
499
503
  * @see {@link https://api.jquery.com/deferred.resolve/}
500
504
  */
501
- resolve(value?: T, ...args: any[]): JQueryDeferred<T>;
505
+ resolve(value?: T, ...args: any[]): JQueryDeferred<T, C>;
502
506
 
503
507
  /**
504
508
  * Resolve a Deferred object and call any doneCallbacks with the given context and args.
@@ -507,7 +511,7 @@ interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
507
511
  * @param args An optional array of arguments that are passed to the doneCallbacks.
508
512
  * @see {@link https://api.jquery.com/deferred.resolveWith/}
509
513
  */
510
- resolveWith(context: any, args?: T[]): JQueryDeferred<T>;
514
+ resolveWith<Context = any>(context: Context, args?: T[]): JQueryDeferred<T, Context>;
511
515
 
512
516
  /**
513
517
  * Return a Deferred's Promise object.
@@ -515,14 +519,14 @@ interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
515
519
  * @param target Object onto which the promise methods have to be attached
516
520
  * @see {@link https://api.jquery.com/deferred.promise/}
517
521
  */
518
- promise(target?: any): JQueryPromise<T>;
522
+ promise(target?: any): JQueryPromise<T, C>;
519
523
 
520
524
  // Deprecated - given no typings
521
525
  pipe(
522
526
  doneFilter?: (x: any) => any,
523
527
  failFilter?: (x: any) => any,
524
528
  progressFilter?: (x: any) => any,
525
- ): JQueryPromise<any>;
529
+ ): JQueryPromise<any, C>;
526
530
  }
527
531
 
528
532
  /**
@@ -829,7 +833,7 @@ interface JQueryStatic {
829
833
  * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup().
830
834
  * @see {@link https://api.jquery.com/jQuery.ajax/#jQuery-ajax-settings}
831
835
  */
832
- ajax(settings: JQueryAjaxSettings): JQueryXHR;
836
+ ajax<C>(settings: JQueryAjaxSettings<C>): JQueryXHR<C>;
833
837
  /**
834
838
  * Perform an asynchronous HTTP (Ajax) request.
835
839
  *
@@ -837,7 +841,7 @@ interface JQueryStatic {
837
841
  * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup().
838
842
  * @see {@link https://api.jquery.com/jQuery.ajax/#jQuery-ajax-url-settings}
839
843
  */
840
- ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR;
844
+ ajax<C>(url: string, settings?: JQueryAjaxSettings<C>): JQueryXHR<C>;
841
845
 
842
846
  /**
843
847
  * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().
@@ -910,7 +914,7 @@ interface JQueryStatic {
910
914
  * @param settings The JQueryAjaxSettings to be used for the request
911
915
  * @see {@link https://api.jquery.com/jQuery.get/#jQuery-get-settings}
912
916
  */
913
- get(settings: JQueryAjaxSettings): JQueryXHR;
917
+ get<C>(settings: JQueryAjaxSettings<C>): JQueryXHR<C>;
914
918
  /**
915
919
  * Load JSON-encoded data from the server using a GET HTTP request.
916
920
  *
@@ -978,7 +982,7 @@ interface JQueryStatic {
978
982
  * @param settings The JQueryAjaxSettings to be used for the request
979
983
  * @see {@link https://api.jquery.com/jQuery.post/#jQuery-post-settings}
980
984
  */
981
- post(settings: JQueryAjaxSettings): JQueryXHR;
985
+ post<C>(settings: JQueryAjaxSettings<C>): JQueryXHR<C>;
982
986
  /**
983
987
  * A multi-purpose callbacks list object that provides a powerful way to manage callback lists.
984
988
  *
@@ -1154,7 +1158,7 @@ interface JQueryStatic {
1154
1158
  * @param newQueue An array of functions to replace the current queue contents.
1155
1159
  * @see {@link https://api.jquery.com/jQuery.queue/#jQuery-queue-element-queueName-newQueue}
1156
1160
  */
1157
- queue(element: Element, queueName: string, newQueue: Function[]): JQuery;
1161
+ queue(element: Element, queueName: string, newQueue: BoundFunction[]): JQuery;
1158
1162
  /**
1159
1163
  * Manipulate the queue of functions to be executed on the matched element.
1160
1164
  *
@@ -1163,7 +1167,7 @@ interface JQueryStatic {
1163
1167
  * @param callback The new function to add to the queue.
1164
1168
  * @see {@link https://api.jquery.com/jQuery.queue/#jQuery-queue-element-queueName-callback}
1165
1169
  */
1166
- queue(element: Element, queueName: string, callback: Function): JQuery;
1170
+ queue(element: Element, queueName: string, callback: BoundFunction): JQuery;
1167
1171
 
1168
1172
  /**
1169
1173
  * Remove a previously-stored piece of data.
@@ -1232,7 +1236,7 @@ interface JQueryStatic {
1232
1236
  * @param message The message to send out.
1233
1237
  * @see {@link https://api.jquery.com/jQuery.error/}
1234
1238
  */
1235
- error(message: any): JQuery;
1239
+ error(message: any): any;
1236
1240
 
1237
1241
  expr: any;
1238
1242
  readonly fn: JQuery;
@@ -1262,7 +1266,7 @@ interface JQueryStatic {
1262
1266
  each<T>(
1263
1267
  collection: T[],
1264
1268
  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
1265
- callback: (indexInArray: number, valueOfElement: T) => boolean | void,
1269
+ callback: (this: T, indexInArray: number, valueOfElement: T) => boolean | void,
1266
1270
  ): T[];
1267
1271
 
1268
1272
  /**
@@ -1501,7 +1505,9 @@ interface JQuery {
1501
1505
  * @param handler The function to be invoked.
1502
1506
  * @see {@link https://api.jquery.com/ajaxComplete/}
1503
1507
  */
1504
- ajaxComplete(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: any) => any): JQuery;
1508
+ ajaxComplete(
1509
+ handler: (this: HTMLElement, event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: any) => any,
1510
+ ): JQuery;
1505
1511
  /**
1506
1512
  * Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event.
1507
1513
  *
@@ -1510,6 +1516,7 @@ interface JQuery {
1510
1516
  */
1511
1517
  ajaxError(
1512
1518
  handler: (
1519
+ this: HTMLElement,
1513
1520
  event: JQueryEventObject,
1514
1521
  jqXHR: JQueryXHR,
1515
1522
  ajaxSettings: JQueryAjaxSettings,
@@ -1522,21 +1529,28 @@ interface JQuery {
1522
1529
  * @param handler The function to be invoked.
1523
1530
  * @see {@link https://api.jquery.com/ajaxSend/}
1524
1531
  */
1525
- ajaxSend(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxOptions: JQueryAjaxSettings) => any): JQuery;
1532
+ ajaxSend(
1533
+ handler: (
1534
+ this: HTMLElement,
1535
+ event: JQueryEventObject,
1536
+ jqXHR: JQueryXHR,
1537
+ ajaxOptions: JQueryAjaxSettings,
1538
+ ) => any,
1539
+ ): JQuery;
1526
1540
  /**
1527
1541
  * Register a handler to be called when the first Ajax request begins. This is an Ajax Event.
1528
1542
  *
1529
1543
  * @param handler The function to be invoked.
1530
1544
  * @see {@link https://api.jquery.com/ajaxStart/}
1531
1545
  */
1532
- ajaxStart(handler: () => any): JQuery;
1546
+ ajaxStart(handler: (this: HTMLElement) => any): JQuery;
1533
1547
  /**
1534
1548
  * Register a handler to be called when all Ajax requests have completed. This is an Ajax Event.
1535
1549
  *
1536
1550
  * @param handler The function to be invoked.
1537
1551
  * @see {@link https://api.jquery.com/ajaxStop/}
1538
1552
  */
1539
- ajaxStop(handler: () => any): JQuery;
1553
+ ajaxStop(handler: (this: HTMLElement) => any): JQuery;
1540
1554
  /**
1541
1555
  * Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event.
1542
1556
  *
@@ -1544,7 +1558,12 @@ interface JQuery {
1544
1558
  * @see {@link https://api.jquery.com/ajaxSuccess/}
1545
1559
  */
1546
1560
  ajaxSuccess(
1547
- handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: JQueryAjaxSettings) => any,
1561
+ handler: (
1562
+ this: HTMLElement,
1563
+ event: JQueryEventObject,
1564
+ XMLHttpRequest: XMLHttpRequest,
1565
+ ajaxOptions: JQueryAjaxSettings,
1566
+ ) => any,
1548
1567
  ): JQuery;
1549
1568
 
1550
1569
  /**
@@ -1615,7 +1634,7 @@ interface JQuery {
1615
1634
  * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old attribute value as arguments.
1616
1635
  * @see {@link https://api.jquery.com/attr/#attr-attributeName-function}
1617
1636
  */
1618
- attr(attributeName: string, func: (index: number, attr: string) => string | number): JQuery;
1637
+ attr(attributeName: string, func: (this: HTMLElement, index: number, attr: string) => string | number): JQuery;
1619
1638
  /**
1620
1639
  * Set one or more attributes for the set of matched elements.
1621
1640
  *
@@ -1756,7 +1775,7 @@ interface JQuery {
1756
1775
  * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
1757
1776
  * @see {@link https://api.jquery.com/val/#val-function}
1758
1777
  */
1759
- val(func: (index: number, value: string) => string): JQuery;
1778
+ val(func: (this: HTMLElement, index: number, value: string) => string): JQuery;
1760
1779
 
1761
1780
  /**
1762
1781
  * Get the value of style properties for the first element in the set of matched elements.
@@ -2030,7 +2049,7 @@ interface JQuery {
2030
2049
  * @param complete A function to call once the animation is complete.
2031
2050
  * @see {@link https://api.jquery.com/animate/#animate-properties-duration-easing-complete}
2032
2051
  */
2033
- animate(properties: Object, duration?: string | number, complete?: Function): JQuery;
2052
+ animate(properties: Object, duration?: string | number, complete?: BoundFunction): JQuery;
2034
2053
  /**
2035
2054
  * Perform a custom animation of a set of CSS properties.
2036
2055
  *
@@ -2040,7 +2059,7 @@ interface JQuery {
2040
2059
  * @param complete A function to call once the animation is complete.
2041
2060
  * @see {@link https://api.jquery.com/animate/#animate-properties-duration-easing-complete}
2042
2061
  */
2043
- animate(properties: Object, duration?: string | number, easing?: string, complete?: Function): JQuery;
2062
+ animate(properties: Object, duration?: string | number, easing?: string, complete?: BoundFunction): JQuery;
2044
2063
  /**
2045
2064
  * Perform a custom animation of a set of CSS properties.
2046
2065
  *
@@ -2066,7 +2085,7 @@ interface JQuery {
2066
2085
  * @param complete A function to call once the animation is complete.
2067
2086
  * @see {@link https://api.jquery.com/fadeIn/#fadeIn-duration-complete}
2068
2087
  */
2069
- fadeIn(duration?: number | string, complete?: Function): JQuery;
2088
+ fadeIn(duration?: number | string, complete?: BoundFunction): JQuery;
2070
2089
  /**
2071
2090
  * Display the matched elements by fading them to opaque.
2072
2091
  *
@@ -2075,7 +2094,7 @@ interface JQuery {
2075
2094
  * @param complete A function to call once the animation is complete.
2076
2095
  * @see {@link https://api.jquery.com/fadeIn/#fadeIn-duration-easing-complete}
2077
2096
  */
2078
- fadeIn(duration?: number | string, easing?: string, complete?: Function): JQuery;
2097
+ fadeIn(duration?: number | string, easing?: string, complete?: BoundFunction): JQuery;
2079
2098
  /**
2080
2099
  * Display the matched elements by fading them to opaque.
2081
2100
  *
@@ -2091,7 +2110,7 @@ interface JQuery {
2091
2110
  * @param complete A function to call once the animation is complete.
2092
2111
  * @see {@link https://api.jquery.com/fadeOut/#fadeOut-duration-complete}
2093
2112
  */
2094
- fadeOut(duration?: number | string, complete?: Function): JQuery;
2113
+ fadeOut(duration?: number | string, complete?: BoundFunction): JQuery;
2095
2114
  /**
2096
2115
  * Hide the matched elements by fading them to transparent.
2097
2116
  *
@@ -2100,7 +2119,7 @@ interface JQuery {
2100
2119
  * @param complete A function to call once the animation is complete.
2101
2120
  * @see {@link https://api.jquery.com/fadeOut/#fadeOut-duration-easing-complete}
2102
2121
  */
2103
- fadeOut(duration?: number | string, easing?: string, complete?: Function): JQuery;
2122
+ fadeOut(duration?: number | string, easing?: string, complete?: BoundFunction): JQuery;
2104
2123
  /**
2105
2124
  * Hide the matched elements by fading them to transparent.
2106
2125
  *
@@ -2117,7 +2136,7 @@ interface JQuery {
2117
2136
  * @param complete A function to call once the animation is complete.
2118
2137
  * @see {@link https://api.jquery.com/fadeTo/#fadeTo-duration-opacity-complete}
2119
2138
  */
2120
- fadeTo(duration: string | number, opacity: number, complete?: Function): JQuery;
2139
+ fadeTo(duration: string | number, opacity: number, complete?: BoundFunction): JQuery;
2121
2140
  /**
2122
2141
  * Adjust the opacity of the matched elements.
2123
2142
  *
@@ -2127,7 +2146,7 @@ interface JQuery {
2127
2146
  * @param complete A function to call once the animation is complete.
2128
2147
  * @see {@link https://api.jquery.com/fadeTo/#fadeTo-duration-opacity-easing-complete}
2129
2148
  */
2130
- fadeTo(duration: string | number, opacity: number, easing?: string, complete?: Function): JQuery;
2149
+ fadeTo(duration: string | number, opacity: number, easing?: string, complete?: BoundFunction): JQuery;
2131
2150
 
2132
2151
  /**
2133
2152
  * Display or hide the matched elements by animating their opacity.
@@ -2136,7 +2155,7 @@ interface JQuery {
2136
2155
  * @param complete A function to call once the animation is complete.
2137
2156
  * @see {@link https://api.jquery.com/fadeToggle/#fadeToggle-duration-easing-complete}
2138
2157
  */
2139
- fadeToggle(duration?: number | string, complete?: Function): JQuery;
2158
+ fadeToggle(duration?: number | string, complete?: BoundFunction): JQuery;
2140
2159
  /**
2141
2160
  * Display or hide the matched elements by animating their opacity.
2142
2161
  *
@@ -2145,7 +2164,7 @@ interface JQuery {
2145
2164
  * @param complete A function to call once the animation is complete.
2146
2165
  * @see {@link https://api.jquery.com/fadeToggle/#fadeToggle-duration-easing-complete}
2147
2166
  */
2148
- fadeToggle(duration?: number | string, easing?: string, complete?: Function): JQuery;
2167
+ fadeToggle(duration?: number | string, easing?: string, complete?: BoundFunction): JQuery;
2149
2168
  /**
2150
2169
  * Display or hide the matched elements by animating their opacity.
2151
2170
  *
@@ -2169,7 +2188,7 @@ interface JQuery {
2169
2188
  * @param complete A function to call once the animation is complete.
2170
2189
  * @see {@link https://api.jquery.com/hide/#hide}
2171
2190
  */
2172
- hide(duration?: number | string, complete?: Function): JQuery;
2191
+ hide(duration?: number | string, complete?: BoundFunction): JQuery;
2173
2192
  /**
2174
2193
  * Hide the matched elements.
2175
2194
  *
@@ -2178,7 +2197,7 @@ interface JQuery {
2178
2197
  * @param complete A function to call once the animation is complete.
2179
2198
  * @see {@link https://api.jquery.com/hide/#hide-duration-easing-complete}
2180
2199
  */
2181
- hide(duration?: number | string, easing?: string, complete?: Function): JQuery;
2200
+ hide(duration?: number | string, easing?: string, complete?: BoundFunction): JQuery;
2182
2201
  /**
2183
2202
  * Hide the matched elements.
2184
2203
  *
@@ -2194,7 +2213,7 @@ interface JQuery {
2194
2213
  * @param complete A function to call once the animation is complete.
2195
2214
  * @see {@link https://api.jquery.com/show/#show}
2196
2215
  */
2197
- show(duration?: number | string, complete?: Function): JQuery;
2216
+ show(duration?: number | string, complete?: BoundFunction): JQuery;
2198
2217
  /**
2199
2218
  * Display the matched elements.
2200
2219
  *
@@ -2203,7 +2222,7 @@ interface JQuery {
2203
2222
  * @param complete A function to call once the animation is complete.
2204
2223
  * @see {@link https://api.jquery.com/show/#show-duration-easing-complete}
2205
2224
  */
2206
- show(duration?: number | string, easing?: string, complete?: Function): JQuery;
2225
+ show(duration?: number | string, easing?: string, complete?: BoundFunction): JQuery;
2207
2226
  /**
2208
2227
  * Display the matched elements.
2209
2228
  *
@@ -2219,7 +2238,7 @@ interface JQuery {
2219
2238
  * @param complete A function to call once the animation is complete.
2220
2239
  * @see {@link https://api.jquery.com/slideDown/#slideDown-duration-complete}
2221
2240
  */
2222
- slideDown(duration?: number | string, complete?: Function): JQuery;
2241
+ slideDown(duration?: number | string, complete?: BoundFunction): JQuery;
2223
2242
  /**
2224
2243
  * Display the matched elements with a sliding motion.
2225
2244
  *
@@ -2228,7 +2247,7 @@ interface JQuery {
2228
2247
  * @param complete A function to call once the animation is complete.
2229
2248
  * @see {@link https://api.jquery.com/slideDown/#slideDown-duration-easing-complete}
2230
2249
  */
2231
- slideDown(duration?: number | string, easing?: string, complete?: Function): JQuery;
2250
+ slideDown(duration?: number | string, easing?: string, complete?: BoundFunction): JQuery;
2232
2251
  /**
2233
2252
  * Display the matched elements with a sliding motion.
2234
2253
  *
@@ -2244,7 +2263,7 @@ interface JQuery {
2244
2263
  * @param complete A function to call once the animation is complete.
2245
2264
  * @see {@link https://api.jquery.com/slideToggle/#slideToggle-duration-complete}
2246
2265
  */
2247
- slideToggle(duration?: number | string, complete?: Function): JQuery;
2266
+ slideToggle(duration?: number | string, complete?: BoundFunction): JQuery;
2248
2267
  /**
2249
2268
  * Display or hide the matched elements with a sliding motion.
2250
2269
  *
@@ -2253,7 +2272,7 @@ interface JQuery {
2253
2272
  * @param complete A function to call once the animation is complete.
2254
2273
  * @see {@link https://api.jquery.com/slideToggle/#slideToggle-duration-easing-complete}
2255
2274
  */
2256
- slideToggle(duration?: number | string, easing?: string, complete?: Function): JQuery;
2275
+ slideToggle(duration?: number | string, easing?: string, complete?: BoundFunction): JQuery;
2257
2276
  /**
2258
2277
  * Display or hide the matched elements with a sliding motion.
2259
2278
  *
@@ -2269,7 +2288,7 @@ interface JQuery {
2269
2288
  * @param complete A function to call once the animation is complete.
2270
2289
  * @see {@link https://api.jquery.com/slideUp/#slideUp-duration-complete}
2271
2290
  */
2272
- slideUp(duration?: number | string, complete?: Function): JQuery;
2291
+ slideUp(duration?: number | string, complete?: BoundFunction): JQuery;
2273
2292
  /**
2274
2293
  * Hide the matched elements with a sliding motion.
2275
2294
  *
@@ -2278,7 +2297,7 @@ interface JQuery {
2278
2297
  * @param complete A function to call once the animation is complete.
2279
2298
  * @see {@link https://api.jquery.com/slideUp/#slideUp-duration-easing-complete}
2280
2299
  */
2281
- slideUp(duration?: number | string, easing?: string, complete?: Function): JQuery;
2300
+ slideUp(duration?: number | string, easing?: string, complete?: BoundFunction): JQuery;
2282
2301
  /**
2283
2302
  * Hide the matched elements with a sliding motion.
2284
2303
  *
@@ -2312,7 +2331,7 @@ interface JQuery {
2312
2331
  * @param complete A function to call once the animation is complete.
2313
2332
  * @see {@link https://api.jquery.com/toggle/#toggle-duration-complete}
2314
2333
  */
2315
- toggle(duration?: number | string, complete?: Function): JQuery;
2334
+ toggle(duration?: number | string, complete?: BoundFunction): JQuery;
2316
2335
  /**
2317
2336
  * Display or hide the matched elements.
2318
2337
  *
@@ -2321,7 +2340,7 @@ interface JQuery {
2321
2340
  * @param complete A function to call once the animation is complete.
2322
2341
  * @see {@link https://api.jquery.com/toggle/#toggle-duration-easing-complete}
2323
2342
  */
2324
- toggle(duration?: number | string, easing?: string, complete?: Function): JQuery;
2343
+ toggle(duration?: number | string, easing?: string, complete?: BoundFunction): JQuery;
2325
2344
  /**
2326
2345
  * Display or hide the matched elements.
2327
2346
  *
@@ -2345,7 +2364,11 @@ interface JQuery {
2345
2364
  * @param handler A function to execute each time the event is triggered.
2346
2365
  * @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-handler}
2347
2366
  */
2348
- bind(eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
2367
+ bind(
2368
+ eventType: string,
2369
+ eventData: any,
2370
+ handler: (this: HTMLElement, eventObject: JQueryEventObject) => any,
2371
+ ): JQuery;
2349
2372
  /**
2350
2373
  * Attach a handler to an event for the elements.
2351
2374
  *
@@ -2353,7 +2376,7 @@ interface JQuery {
2353
2376
  * @param handler A function to execute each time the event is triggered.
2354
2377
  * @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-handler}
2355
2378
  */
2356
- bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
2379
+ bind(eventType: string, handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2357
2380
  /**
2358
2381
  * Attach a handler to an event for the elements.
2359
2382
  *
@@ -2390,7 +2413,7 @@ interface JQuery {
2390
2413
  * @param handler A function to execute each time the event is triggered.
2391
2414
  * @see {@link https://api.jquery.com/blur/#blur-handler}
2392
2415
  */
2393
- blur(handler: (eventObject: JQueryEventObject) => any): JQuery;
2416
+ blur(handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2394
2417
  /**
2395
2418
  * Bind an event handler to the "blur" JavaScript event
2396
2419
  *
@@ -2398,7 +2421,7 @@ interface JQuery {
2398
2421
  * @param handler A function to execute each time the event is triggered.
2399
2422
  * @see {@link https://api.jquery.com/blur/#blur-eventData-handler}
2400
2423
  */
2401
- blur(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
2424
+ blur(eventData?: any, handler?: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2402
2425
 
2403
2426
  /**
2404
2427
  * Trigger the "change" event on an element.
@@ -2411,7 +2434,7 @@ interface JQuery {
2411
2434
  * @param handler A function to execute each time the event is triggered.
2412
2435
  * @see {@link https://api.jquery.com/change/#change-handler}
2413
2436
  */
2414
- change(handler: (eventObject: JQueryEventObject) => any): JQuery;
2437
+ change(handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2415
2438
  /**
2416
2439
  * Bind an event handler to the "change" JavaScript event
2417
2440
  *
@@ -2419,7 +2442,7 @@ interface JQuery {
2419
2442
  * @param handler A function to execute each time the event is triggered.
2420
2443
  * @see {@link https://api.jquery.com/change/#change-eventData-handler}
2421
2444
  */
2422
- change(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
2445
+ change(eventData?: any, handler?: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2423
2446
 
2424
2447
  /**
2425
2448
  * Trigger the "click" event on an element.
@@ -2432,7 +2455,7 @@ interface JQuery {
2432
2455
  * @param handler A function to execute each time the event is triggered.
2433
2456
  * @see {@link https://api.jquery.com/click/#click-handler}
2434
2457
  */
2435
- click(handler: (eventObject: JQueryEventObject) => any): JQuery;
2458
+ click(handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2436
2459
  /**
2437
2460
  * Bind an event handler to the "click" JavaScript event
2438
2461
  *
@@ -2440,7 +2463,7 @@ interface JQuery {
2440
2463
  * @param handler A function to execute each time the event is triggered.
2441
2464
  * @see {@link https://api.jquery.com/click/#click-eventData-handler}
2442
2465
  */
2443
- click(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
2466
+ click(eventData?: any, handler?: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2444
2467
 
2445
2468
  /**
2446
2469
  * Trigger the "contextmenu" event on an element.
@@ -2453,7 +2476,7 @@ interface JQuery {
2453
2476
  * @param handler A function to execute when the event is triggered.
2454
2477
  * @see {@link https://api.jquery.com/contextmenu/#contextmenu-handler}
2455
2478
  */
2456
- contextmenu(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
2479
+ contextmenu(handler: (this: HTMLElement, eventObject: JQueryMouseEventObject) => any): JQuery;
2457
2480
  /**
2458
2481
  * Bind an event handler to the "contextmenu" JavaScript event.
2459
2482
  *
@@ -2461,7 +2484,7 @@ interface JQuery {
2461
2484
  * @param handler A function to execute when the event is triggered.
2462
2485
  * @see {@link https://api.jquery.com/contextmenu/#contextmenu-eventData-handler}
2463
2486
  */
2464
- contextmenu(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
2487
+ contextmenu(eventData: Object, handler: (this: HTMLElement, eventObject: JQueryMouseEventObject) => any): JQuery;
2465
2488
 
2466
2489
  /**
2467
2490
  * Trigger the "dblclick" event on an element.
@@ -2474,7 +2497,7 @@ interface JQuery {
2474
2497
  * @param handler A function to execute each time the event is triggered.
2475
2498
  * @see {@link https://api.jquery.com/dblclick/#dblclick-handler}
2476
2499
  */
2477
- dblclick(handler: (eventObject: JQueryEventObject) => any): JQuery;
2500
+ dblclick(handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2478
2501
  /**
2479
2502
  * Bind an event handler to the "dblclick" JavaScript event
2480
2503
  *
@@ -2482,13 +2505,17 @@ interface JQuery {
2482
2505
  * @param handler A function to execute each time the event is triggered.
2483
2506
  * @see {@link https://api.jquery.com/dblclick/#dblclick-eventData-handler}
2484
2507
  */
2485
- dblclick(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
2508
+ dblclick(eventData?: any, handler?: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2486
2509
 
2487
2510
  /**
2488
2511
  * Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.
2489
2512
  * @see {@link https://api.jquery.com/delegate/#delegate-selector-eventType-handler}
2490
2513
  */
2491
- delegate(selector: any, eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
2514
+ delegate(
2515
+ selector: any,
2516
+ eventType: string,
2517
+ handler: (this: HTMLElement, eventObject: JQueryEventObject) => any,
2518
+ ): JQuery;
2492
2519
  /**
2493
2520
  * Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.
2494
2521
  * @see {@link https://api.jquery.com/delegate/#delegate-selector-eventType-eventData-handler}
@@ -2497,7 +2524,7 @@ interface JQuery {
2497
2524
  selector: any,
2498
2525
  eventType: string,
2499
2526
  eventData: any,
2500
- handler: (eventObject: JQueryEventObject) => any,
2527
+ handler: (this: HTMLElement, eventObject: JQueryEventObject) => any,
2501
2528
  ): JQuery;
2502
2529
 
2503
2530
  /**
@@ -2511,7 +2538,7 @@ interface JQuery {
2511
2538
  * @param handler A function to execute each time the event is triggered.
2512
2539
  * @see {@link https://api.jquery.com/focus/#focus-handler}
2513
2540
  */
2514
- focus(handler: (eventObject: JQueryEventObject) => any): JQuery;
2541
+ focus(handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2515
2542
  /**
2516
2543
  * Bind an event handler to the "focus" JavaScript event
2517
2544
  *
@@ -2519,7 +2546,7 @@ interface JQuery {
2519
2546
  * @param handler A function to execute each time the event is triggered.
2520
2547
  * @see {@link https://api.jquery.com/focus/#focus-eventData-handler}
2521
2548
  */
2522
- focus(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
2549
+ focus(eventData?: any, handler?: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2523
2550
 
2524
2551
  /**
2525
2552
  * Trigger the "focusin" event on an element.
@@ -2532,7 +2559,7 @@ interface JQuery {
2532
2559
  * @param handler A function to execute each time the event is triggered.
2533
2560
  * @see {@link https://api.jquery.com/focusin/#focusin-handler}
2534
2561
  */
2535
- focusin(handler: (eventObject: JQueryEventObject) => any): JQuery;
2562
+ focusin(handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2536
2563
  /**
2537
2564
  * Bind an event handler to the "focusin" JavaScript event
2538
2565
  *
@@ -2540,7 +2567,7 @@ interface JQuery {
2540
2567
  * @param handler A function to execute each time the event is triggered.
2541
2568
  * @see {@link https://api.jquery.com/focusin/#focusin-eventData-handler}
2542
2569
  */
2543
- focusin(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
2570
+ focusin(eventData: Object, handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2544
2571
 
2545
2572
  /**
2546
2573
  * Trigger the "focusout" event on an element.
@@ -2553,7 +2580,7 @@ interface JQuery {
2553
2580
  * @param handler A function to execute each time the event is triggered.
2554
2581
  * @see {@link https://api.jquery.com/focusout/#focusout-handler}
2555
2582
  */
2556
- focusout(handler: (eventObject: JQueryEventObject) => any): JQuery;
2583
+ focusout(handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2557
2584
  /**
2558
2585
  * Bind an event handler to the "focusout" JavaScript event
2559
2586
  *
@@ -2561,7 +2588,7 @@ interface JQuery {
2561
2588
  * @param handler A function to execute each time the event is triggered.
2562
2589
  * @see {@link https://api.jquery.com/focusout/#focusout-eventData-handler}
2563
2590
  */
2564
- focusout(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
2591
+ focusout(eventData: Object, handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2565
2592
 
2566
2593
  /**
2567
2594
  * Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.
@@ -2571,8 +2598,8 @@ interface JQuery {
2571
2598
  * @see {@link https://api.jquery.com/hover/#hover-handlerIn-handlerOut}
2572
2599
  */
2573
2600
  hover(
2574
- handlerIn: (eventObject: JQueryEventObject) => any,
2575
- handlerOut: (eventObject: JQueryEventObject) => any,
2601
+ handlerIn: (this: HTMLElement, eventObject: JQueryEventObject) => any,
2602
+ handlerOut: (this: HTMLElement, eventObject: JQueryEventObject) => any,
2576
2603
  ): JQuery;
2577
2604
  /**
2578
2605
  * Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements.
@@ -2580,7 +2607,7 @@ interface JQuery {
2580
2607
  * @param handlerInOut A function to execute when the mouse pointer enters or leaves the element.
2581
2608
  * @see {@link https://api.jquery.com/hover/#hover-handlerInOut}
2582
2609
  */
2583
- hover(handlerInOut: (eventObject: JQueryEventObject) => any): JQuery;
2610
+ hover(handlerInOut: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2584
2611
 
2585
2612
  /**
2586
2613
  * Trigger the "keydown" event on an element.
@@ -2593,7 +2620,7 @@ interface JQuery {
2593
2620
  * @param handler A function to execute each time the event is triggered.
2594
2621
  * @see {@link https://api.jquery.com/keydown/#keydown-handler}
2595
2622
  */
2596
- keydown(handler: (eventObject: JQueryKeyEventObject) => any): JQuery;
2623
+ keydown(handler: (this: HTMLElement, eventObject: JQueryKeyEventObject) => any): JQuery;
2597
2624
  /**
2598
2625
  * Bind an event handler to the "keydown" JavaScript event
2599
2626
  *
@@ -2601,7 +2628,7 @@ interface JQuery {
2601
2628
  * @param handler A function to execute each time the event is triggered.
2602
2629
  * @see {@link https://api.jquery.com/keydown/#keydown-eventData-handler}
2603
2630
  */
2604
- keydown(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery;
2631
+ keydown(eventData?: any, handler?: (this: HTMLElement, eventObject: JQueryKeyEventObject) => any): JQuery;
2605
2632
 
2606
2633
  /**
2607
2634
  * Trigger the "keypress" event on an element.
@@ -2614,7 +2641,7 @@ interface JQuery {
2614
2641
  * @param handler A function to execute each time the event is triggered.
2615
2642
  * @see {@link https://api.jquery.com/keypress/#keypress-handler}
2616
2643
  */
2617
- keypress(handler: (eventObject: JQueryKeyEventObject) => any): JQuery;
2644
+ keypress(handler: (this: HTMLElement, eventObject: JQueryKeyEventObject) => any): JQuery;
2618
2645
  /**
2619
2646
  * Bind an event handler to the "keypress" JavaScript event
2620
2647
  *
@@ -2622,7 +2649,7 @@ interface JQuery {
2622
2649
  * @param handler A function to execute each time the event is triggered.
2623
2650
  * @see {@link https://api.jquery.com/keypress/#keypress-eventData-handler}
2624
2651
  */
2625
- keypress(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery;
2652
+ keypress(eventData?: any, handler?: (this: HTMLElement, eventObject: JQueryKeyEventObject) => any): JQuery;
2626
2653
 
2627
2654
  /**
2628
2655
  * Trigger the "keyup" event on an element.
@@ -2635,7 +2662,7 @@ interface JQuery {
2635
2662
  * @param handler A function to execute each time the event is triggered.
2636
2663
  * @see {@link https://api.jquery.com/keyup/#keyup-handler}
2637
2664
  */
2638
- keyup(handler: (eventObject: JQueryKeyEventObject) => any): JQuery;
2665
+ keyup(handler: (this: HTMLElement, eventObject: JQueryKeyEventObject) => any): JQuery;
2639
2666
  /**
2640
2667
  * Bind an event handler to the "keyup" JavaScript event
2641
2668
  *
@@ -2643,7 +2670,7 @@ interface JQuery {
2643
2670
  * @param handler A function to execute each time the event is triggered.
2644
2671
  * @see {@link https://api.jquery.com/keyup/#keyup-eventData-handler}
2645
2672
  */
2646
- keyup(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery;
2673
+ keyup(eventData?: any, handler?: (this: HTMLElement, eventObject: JQueryKeyEventObject) => any): JQuery;
2647
2674
 
2648
2675
  /**
2649
2676
  * Bind an event handler to the "load" JavaScript event.
@@ -2651,7 +2678,7 @@ interface JQuery {
2651
2678
  * @param handler A function to execute when the event is triggered.
2652
2679
  * @see {@link https://api.jquery.com/load/}
2653
2680
  */
2654
- load(handler: (eventObject: JQueryEventObject) => any): JQuery;
2681
+ load(handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2655
2682
  /**
2656
2683
  * Bind an event handler to the "load" JavaScript event.
2657
2684
  *
@@ -2659,7 +2686,7 @@ interface JQuery {
2659
2686
  * @param handler A function to execute when the event is triggered.
2660
2687
  * @see {@link https://api.jquery.com/load/}
2661
2688
  */
2662
- load(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
2689
+ load(eventData?: any, handler?: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2663
2690
 
2664
2691
  /**
2665
2692
  * Trigger the "mousedown" event on an element.
@@ -2672,7 +2699,7 @@ interface JQuery {
2672
2699
  * @param handler A function to execute when the event is triggered.
2673
2700
  * @see {@link https://api.jquery.com/mousedown/#mousedown-handler}
2674
2701
  */
2675
- mousedown(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
2702
+ mousedown(handler: (this: HTMLElement, eventObject: JQueryMouseEventObject) => any): JQuery;
2676
2703
  /**
2677
2704
  * Bind an event handler to the "mousedown" JavaScript event.
2678
2705
  *
@@ -2680,7 +2707,7 @@ interface JQuery {
2680
2707
  * @param handler A function to execute when the event is triggered.
2681
2708
  * @see {@link https://api.jquery.com/mousedown/#mousedown-eventData-handler}
2682
2709
  */
2683
- mousedown(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
2710
+ mousedown(eventData: Object, handler: (this: HTMLElement, eventObject: JQueryMouseEventObject) => any): JQuery;
2684
2711
 
2685
2712
  /**
2686
2713
  * Trigger the "mouseenter" event on an element.
@@ -2693,7 +2720,7 @@ interface JQuery {
2693
2720
  * @param handler A function to execute when the event is triggered.
2694
2721
  * @see {@link https://api.jquery.com/mouseenter/#mouseenter-handler}
2695
2722
  */
2696
- mouseenter(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
2723
+ mouseenter(handler: (this: HTMLElement, eventObject: JQueryMouseEventObject) => any): JQuery;
2697
2724
  /**
2698
2725
  * Bind an event handler to be fired when the mouse enters an element.
2699
2726
  *
@@ -2701,7 +2728,7 @@ interface JQuery {
2701
2728
  * @param handler A function to execute when the event is triggered.
2702
2729
  * @see {@link https://api.jquery.com/mouseenter/#mouseenter-eventData-handler}
2703
2730
  */
2704
- mouseenter(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
2731
+ mouseenter(eventData: Object, handler: (this: HTMLElement, eventObject: JQueryMouseEventObject) => any): JQuery;
2705
2732
 
2706
2733
  /**
2707
2734
  * Trigger the "mouseleave" event on an element.
@@ -2714,7 +2741,7 @@ interface JQuery {
2714
2741
  * @param handler A function to execute when the event is triggered.
2715
2742
  * @see {@link https://api.jquery.com/mouseleave/#mouseleave-handler}
2716
2743
  */
2717
- mouseleave(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
2744
+ mouseleave(handler: (this: HTMLElement, eventObject: JQueryMouseEventObject) => any): JQuery;
2718
2745
  /**
2719
2746
  * Bind an event handler to be fired when the mouse leaves an element.
2720
2747
  *
@@ -2722,7 +2749,7 @@ interface JQuery {
2722
2749
  * @param handler A function to execute when the event is triggered.
2723
2750
  * @see {@link https://api.jquery.com/mouseleave/#mouseleave-eventData-handler}
2724
2751
  */
2725
- mouseleave(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
2752
+ mouseleave(eventData: Object, handler: (this: HTMLElement, eventObject: JQueryMouseEventObject) => any): JQuery;
2726
2753
 
2727
2754
  /**
2728
2755
  * Trigger the "mousemove" event on an element.
@@ -2735,7 +2762,7 @@ interface JQuery {
2735
2762
  * @param handler A function to execute when the event is triggered.
2736
2763
  * @see {@link https://api.jquery.com/mousemove/#mousemove-handler}
2737
2764
  */
2738
- mousemove(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
2765
+ mousemove(handler: (this: HTMLElement, eventObject: JQueryMouseEventObject) => any): JQuery;
2739
2766
  /**
2740
2767
  * Bind an event handler to the "mousemove" JavaScript event.
2741
2768
  *
@@ -2743,7 +2770,7 @@ interface JQuery {
2743
2770
  * @param handler A function to execute when the event is triggered.
2744
2771
  * @see {@link https://api.jquery.com/mousemove/#mousemove-eventData-handler}
2745
2772
  */
2746
- mousemove(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
2773
+ mousemove(eventData: Object, handler: (this: HTMLElement, eventObject: JQueryMouseEventObject) => any): JQuery;
2747
2774
 
2748
2775
  /**
2749
2776
  * Trigger the "mouseout" event on an element.
@@ -2756,7 +2783,7 @@ interface JQuery {
2756
2783
  * @param handler A function to execute when the event is triggered.
2757
2784
  * @see {@link https://api.jquery.com/mouseout/#mouseout-handler}
2758
2785
  */
2759
- mouseout(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
2786
+ mouseout(handler: (this: HTMLElement, eventObject: JQueryMouseEventObject) => any): JQuery;
2760
2787
  /**
2761
2788
  * Bind an event handler to the "mouseout" JavaScript event.
2762
2789
  *
@@ -2764,7 +2791,7 @@ interface JQuery {
2764
2791
  * @param handler A function to execute when the event is triggered.
2765
2792
  * @see {@link https://api.jquery.com/mouseout/#mouseout-eventData-handler}
2766
2793
  */
2767
- mouseout(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
2794
+ mouseout(eventData: Object, handler: (this: HTMLElement, eventObject: JQueryMouseEventObject) => any): JQuery;
2768
2795
 
2769
2796
  /**
2770
2797
  * Trigger the "mouseover" event on an element.
@@ -2777,7 +2804,7 @@ interface JQuery {
2777
2804
  * @param handler A function to execute when the event is triggered.
2778
2805
  * @see {@link https://api.jquery.com/mouseover/#mouseover-handler}
2779
2806
  */
2780
- mouseover(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
2807
+ mouseover(handler: (this: HTMLElement, eventObject: JQueryMouseEventObject) => any): JQuery;
2781
2808
  /**
2782
2809
  * Bind an event handler to the "mouseover" JavaScript event.
2783
2810
  *
@@ -2785,7 +2812,7 @@ interface JQuery {
2785
2812
  * @param handler A function to execute when the event is triggered.
2786
2813
  * @see {@link https://api.jquery.com/mouseover/#mouseover-eventData-handler}
2787
2814
  */
2788
- mouseover(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
2815
+ mouseover(eventData: Object, handler: (this: HTMLElement, eventObject: JQueryMouseEventObject) => any): JQuery;
2789
2816
 
2790
2817
  /**
2791
2818
  * Trigger the "mouseup" event on an element.
@@ -2798,7 +2825,7 @@ interface JQuery {
2798
2825
  * @param handler A function to execute when the event is triggered.
2799
2826
  * @see {@link https://api.jquery.com/mouseup/#mouseup-handler}
2800
2827
  */
2801
- mouseup(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
2828
+ mouseup(handler: (this: HTMLElement, eventObject: JQueryMouseEventObject) => any): JQuery;
2802
2829
  /**
2803
2830
  * Bind an event handler to the "mouseup" JavaScript event.
2804
2831
  *
@@ -2806,7 +2833,7 @@ interface JQuery {
2806
2833
  * @param handler A function to execute when the event is triggered.
2807
2834
  * @see {@link https://api.jquery.com/mouseup/#mouseup-eventData-handler}
2808
2835
  */
2809
- mouseup(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
2836
+ mouseup(eventData: Object, handler: (this: HTMLElement, eventObject: JQueryMouseEventObject) => any): JQuery;
2810
2837
 
2811
2838
  /**
2812
2839
  * Remove an event handler.
@@ -2821,7 +2848,11 @@ interface JQuery {
2821
2848
  * @param handler A handler function previously attached for the event(s), or the special value false.
2822
2849
  * @see {@link https://api.jquery.com/off/#off-events-selector-handler}
2823
2850
  */
2824
- off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
2851
+ off(
2852
+ events: string,
2853
+ selector?: string,
2854
+ handler?: (this: HTMLElement, eventObject: JQueryEventObject) => any,
2855
+ ): JQuery;
2825
2856
  /**
2826
2857
  * Remove an event handler.
2827
2858
  *
@@ -2829,7 +2860,7 @@ interface JQuery {
2829
2860
  * @param handler A handler function previously attached for the event(s), or the special value false. Takes handler with extra args that can be attached with on().
2830
2861
  * @see {@link https://api.jquery.com/off/#off-events-selector-handler}
2831
2862
  */
2832
- off(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
2863
+ off(events: string, handler: (this: HTMLElement, eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
2833
2864
  /**
2834
2865
  * Remove an event handler.
2835
2866
  *
@@ -2837,7 +2868,7 @@ interface JQuery {
2837
2868
  * @param handler A handler function previously attached for the event(s), or the special value false.
2838
2869
  * @see {@link https://api.jquery.com/off/#off-events-selector-handler}
2839
2870
  */
2840
- off(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
2871
+ off(events: string, handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2841
2872
  /**
2842
2873
  * Remove an event handler.
2843
2874
  *
@@ -2854,7 +2885,7 @@ interface JQuery {
2854
2885
  * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax).
2855
2886
  * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
2856
2887
  */
2857
- on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
2888
+ on(events: string, handler: (this: HTMLElement, eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
2858
2889
  /**
2859
2890
  * Attach an event handler function for one or more events to the selected elements.
2860
2891
  *
@@ -2863,7 +2894,11 @@ interface JQuery {
2863
2894
  * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
2864
2895
  * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
2865
2896
  */
2866
- on(events: string, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery;
2897
+ on(
2898
+ events: string,
2899
+ selector: string,
2900
+ handler: (this: HTMLElement, eventObject: JQueryEventObject, ...eventData: any[]) => any,
2901
+ ): JQuery;
2867
2902
  /**
2868
2903
  * Attach an event handler function for one or more events to the selected elements.
2869
2904
  *
@@ -2872,7 +2907,11 @@ interface JQuery {
2872
2907
  * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
2873
2908
  * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
2874
2909
  */
2875
- on(events: string, data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
2910
+ on(
2911
+ events: string,
2912
+ data: any,
2913
+ handler: (this: HTMLElement, eventObject: JQueryEventObject, ...args: any[]) => any,
2914
+ ): JQuery;
2876
2915
  /**
2877
2916
  * Attach an event handler function for one or more events to the selected elements.
2878
2917
  *
@@ -2886,7 +2925,7 @@ interface JQuery {
2886
2925
  events: string,
2887
2926
  selector: string,
2888
2927
  data: any,
2889
- handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any,
2928
+ handler: (this: HTMLElement, eventObject: JQueryEventObject, ...eventData: any[]) => any,
2890
2929
  ): JQuery;
2891
2930
  /**
2892
2931
  * Attach an event handler function for one or more events to the selected elements.
@@ -2897,7 +2936,7 @@ interface JQuery {
2897
2936
  * @see {@link https://api.jquery.com/on/#on-events-selector-data}
2898
2937
  */
2899
2938
  on(
2900
- events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any },
2939
+ events: { [key: string]: (this: HTMLElement, eventObject: JQueryEventObject, ...args: any[]) => any },
2901
2940
  selector?: string,
2902
2941
  data?: any,
2903
2942
  ): JQuery;
@@ -2908,7 +2947,10 @@ interface JQuery {
2908
2947
  * @param data Data to be passed to the handler in event.data when an event occurs.
2909
2948
  * @see {@link https://api.jquery.com/on/#on-events-selector-data}
2910
2949
  */
2911
- on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any }, data?: any): JQuery;
2950
+ on(
2951
+ events: { [key: string]: (this: HTMLElement, eventObject: JQueryEventObject, ...args: any[]) => any },
2952
+ data?: any,
2953
+ ): JQuery;
2912
2954
 
2913
2955
  /**
2914
2956
  * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
@@ -2917,7 +2959,7 @@ interface JQuery {
2917
2959
  * @param handler A function to execute at the time the event is triggered.
2918
2960
  * @see {@link https://api.jquery.com/one/#one-events-data-handler}
2919
2961
  */
2920
- one(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
2962
+ one(events: string, handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2921
2963
  /**
2922
2964
  * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
2923
2965
  *
@@ -2926,7 +2968,7 @@ interface JQuery {
2926
2968
  * @param handler A function to execute at the time the event is triggered.
2927
2969
  * @see {@link https://api.jquery.com/one/#one-events-data-handler}
2928
2970
  */
2929
- one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
2971
+ one(events: string, data: Object, handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2930
2972
 
2931
2973
  /**
2932
2974
  * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
@@ -2936,7 +2978,7 @@ interface JQuery {
2936
2978
  * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
2937
2979
  * @see {@link https://api.jquery.com/one/#one-events-selector-data-handler}
2938
2980
  */
2939
- one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
2981
+ one(events: string, selector: string, handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2940
2982
  /**
2941
2983
  * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
2942
2984
  *
@@ -2946,7 +2988,12 @@ interface JQuery {
2946
2988
  * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
2947
2989
  * @see {@link https://api.jquery.com/one/#one-events-selector-data-handler}
2948
2990
  */
2949
- one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
2991
+ one(
2992
+ events: string,
2993
+ selector: string,
2994
+ data: any,
2995
+ handler: (this: HTMLElement, eventObject: JQueryEventObject) => any,
2996
+ ): JQuery;
2950
2997
 
2951
2998
  /**
2952
2999
  * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
@@ -2986,7 +3033,7 @@ interface JQuery {
2986
3033
  * @param handler A function to execute each time the event is triggered.
2987
3034
  * @see {@link https://api.jquery.com/resize/#resize-handler}
2988
3035
  */
2989
- resize(handler: (eventObject: JQueryEventObject) => any): JQuery;
3036
+ resize(handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2990
3037
  /**
2991
3038
  * Bind an event handler to the "resize" JavaScript event.
2992
3039
  *
@@ -2994,7 +3041,7 @@ interface JQuery {
2994
3041
  * @param handler A function to execute each time the event is triggered.
2995
3042
  * @see {@link https://api.jquery.com/resize/#resize-eventData-handler}
2996
3043
  */
2997
- resize(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
3044
+ resize(eventData: Object, handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
2998
3045
 
2999
3046
  /**
3000
3047
  * Trigger the "scroll" event on an element.
@@ -3007,7 +3054,7 @@ interface JQuery {
3007
3054
  * @param handler A function to execute each time the event is triggered.
3008
3055
  * @see {@link https://api.jquery.com/scroll/#scroll-handler}
3009
3056
  */
3010
- scroll(handler: (eventObject: JQueryEventObject) => any): JQuery;
3057
+ scroll(handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
3011
3058
  /**
3012
3059
  * Bind an event handler to the "scroll" JavaScript event.
3013
3060
  *
@@ -3015,7 +3062,7 @@ interface JQuery {
3015
3062
  * @param handler A function to execute each time the event is triggered.
3016
3063
  * @see {@link https://api.jquery.com/scroll/#scroll-eventData-handler}
3017
3064
  */
3018
- scroll(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
3065
+ scroll(eventData: Object, handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
3019
3066
 
3020
3067
  /**
3021
3068
  * Trigger the "select" event on an element.
@@ -3028,7 +3075,7 @@ interface JQuery {
3028
3075
  * @param handler A function to execute each time the event is triggered.
3029
3076
  * @see {@link https://api.jquery.com/select/#select-handler}
3030
3077
  */
3031
- select(handler: (eventObject: JQueryEventObject) => any): JQuery;
3078
+ select(handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
3032
3079
  /**
3033
3080
  * Bind an event handler to the "select" JavaScript event.
3034
3081
  *
@@ -3036,7 +3083,7 @@ interface JQuery {
3036
3083
  * @param handler A function to execute each time the event is triggered.
3037
3084
  * @see {@link https://api.jquery.com/select/#select-eventData-handler}
3038
3085
  */
3039
- select(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
3086
+ select(eventData: Object, handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
3040
3087
 
3041
3088
  /**
3042
3089
  * Trigger the "submit" event on an element.
@@ -3049,7 +3096,7 @@ interface JQuery {
3049
3096
  * @param handler A function to execute each time the event is triggered.
3050
3097
  * @see {@link https://api.jquery.com/submit/#submit-handler}
3051
3098
  */
3052
- submit(handler: (eventObject: JQueryEventObject) => any): JQuery;
3099
+ submit(handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
3053
3100
  /**
3054
3101
  * Bind an event handler to the "submit" JavaScript event
3055
3102
  *
@@ -3057,7 +3104,7 @@ interface JQuery {
3057
3104
  * @param handler A function to execute each time the event is triggered.
3058
3105
  * @see {@link https://api.jquery.com/submit/#submit-eventData-handler}
3059
3106
  */
3060
- submit(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
3107
+ submit(eventData?: any, handler?: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
3061
3108
 
3062
3109
  /**
3063
3110
  * Execute all handlers and behaviors attached to the matched elements for the given event type.
@@ -3101,7 +3148,7 @@ interface JQuery {
3101
3148
  * @param handler The function that is to be no longer executed.
3102
3149
  * @see {@link https://api.jquery.com/unbind/#unbind-eventType-handler}
3103
3150
  */
3104
- unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
3151
+ unbind(eventType?: string, handler?: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
3105
3152
  /**
3106
3153
  * Remove a previously-attached event handler from the elements.
3107
3154
  *
@@ -3131,7 +3178,11 @@ interface JQuery {
3131
3178
  * @param handler A function to execute at the time the event is triggered.
3132
3179
  * @see {@link https://api.jquery.com/undelegate/#undelegate-selector-eventType}
3133
3180
  */
3134
- undelegate(selector: string, eventType: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
3181
+ undelegate(
3182
+ selector: string,
3183
+ eventType: string,
3184
+ handler?: (this: HTMLElement, eventObject: JQueryEventObject) => any,
3185
+ ): JQuery;
3135
3186
  /**
3136
3187
  * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.
3137
3188
  *
@@ -3154,7 +3205,7 @@ interface JQuery {
3154
3205
  * @param handler A function to execute when the event is triggered.
3155
3206
  * @see {@link https://api.jquery.com/unload/#unload-handler}
3156
3207
  */
3157
- unload(handler: (eventObject: JQueryEventObject) => any): JQuery;
3208
+ unload(handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
3158
3209
  /**
3159
3210
  * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8)
3160
3211
  *
@@ -3162,7 +3213,7 @@ interface JQuery {
3162
3213
  * @param handler A function to execute when the event is triggered.
3163
3214
  * @see {@link https://api.jquery.com/unload/#unload-eventData-handler}
3164
3215
  */
3165
- unload(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
3216
+ unload(eventData?: any, handler?: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
3166
3217
 
3167
3218
  /**
3168
3219
  * The DOM node context originally passed to jQuery(); if none was passed then context will likely be the document. (DEPRECATED from v1.10)
@@ -3178,7 +3229,7 @@ interface JQuery {
3178
3229
  * @param handler A function to execute when the event is triggered.
3179
3230
  * @see {@link https://api.jquery.com/error/#error-handler}
3180
3231
  */
3181
- error(handler: (eventObject: JQueryEventObject) => any): JQuery;
3232
+ error(handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
3182
3233
  /**
3183
3234
  * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8)
3184
3235
  *
@@ -3186,7 +3237,7 @@ interface JQuery {
3186
3237
  * @param handler A function to execute when the event is triggered.
3187
3238
  * @see {@link https://api.jquery.com/error/#error-eventData-handler}
3188
3239
  */
3189
- error(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
3240
+ error(eventData: any, handler: (this: HTMLElement, eventObject: JQueryEventObject) => any): JQuery;
3190
3241
 
3191
3242
  /**
3192
3243
  * Add a collection of DOM elements onto the jQuery stack.
@@ -3219,7 +3270,7 @@ interface JQuery {
3219
3270
  * @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.
3220
3271
  * @see {@link https://api.jquery.com/after/#after-function}
3221
3272
  */
3222
- after(func: (index: number, html: string) => string | Element | JQuery): JQuery;
3273
+ after(func: (this: HTMLElement, index: number, html: string) => string | Element | JQuery): JQuery;
3223
3274
 
3224
3275
  /**
3225
3276
  * Insert content, specified by the parameter, to the end of each element in the set of matched elements.
@@ -3353,7 +3404,7 @@ interface JQuery {
3353
3404
  * @param func A function that returns content with which to replace the set of matched elements.
3354
3405
  * @see {@link https://api.jquery.com/replaceWith/#replaceWith-function}
3355
3406
  */
3356
- replaceWith(func: () => Element | JQuery): JQuery;
3407
+ replaceWith(func: (this: HTMLElement) => Element | JQuery): JQuery;
3357
3408
 
3358
3409
  /**
3359
3410
  * Get the combined text contents of each element in the set of matched elements, including their descendants.
@@ -3401,7 +3452,7 @@ interface JQuery {
3401
3452
  * @param func A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.
3402
3453
  * @see {@link https://api.jquery.com/wrap/#wrap-function}
3403
3454
  */
3404
- wrap(func: (index: number) => string | JQuery): JQuery;
3455
+ wrap(func: (this: HTMLElement, index: number) => string | JQuery): JQuery;
3405
3456
 
3406
3457
  /**
3407
3458
  * Wrap an HTML structure around all elements in the set of matched elements.
@@ -3416,7 +3467,7 @@ interface JQuery {
3416
3467
  * @param func A callback function returning the HTML content or jQuery object to wrap around all the matched elements. Within the function, this refers to the first element in the set.
3417
3468
  * @see {@link https://api.jquery.com/wrapAll/#wrapAll-function}
3418
3469
  */
3419
- wrapAll(func: (index: number) => string): JQuery;
3470
+ wrapAll(func: (this: HTMLElement, index: number) => string): JQuery;
3420
3471
 
3421
3472
  /**
3422
3473
  * Wrap an HTML structure around the content of each element in the set of matched elements.
@@ -3431,7 +3482,7 @@ interface JQuery {
3431
3482
  * @param func A callback function which generates a structure to wrap around the content of the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.
3432
3483
  * @see {@link https://api.jquery.com/wrapInner/#wrapInner-function}
3433
3484
  */
3434
- wrapInner(func: (index: number) => string): JQuery;
3485
+ wrapInner(func: (this: HTMLElement, index: number) => string): JQuery;
3435
3486
 
3436
3487
  /**
3437
3488
  * Iterate over a jQuery object, executing a function for each matched element.
@@ -3440,7 +3491,7 @@ interface JQuery {
3440
3491
  * @see {@link https://api.jquery.com/each/}
3441
3492
  */
3442
3493
  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
3443
- each(func: (index: number, elem: Element) => boolean | void): JQuery;
3494
+ each(func: (this: HTMLElement, index: number, elem: Element) => boolean | void): JQuery;
3444
3495
 
3445
3496
  /**
3446
3497
  * Retrieve one of the elements matched by the jQuery object.
@@ -3592,7 +3643,7 @@ interface JQuery {
3592
3643
  * @param func A function used as a test for each element in the set. this is the current DOM element.
3593
3644
  * @see {@link https://api.jquery.com/filter/#filter-function}
3594
3645
  */
3595
- filter(func: (index: number, element: Element) => boolean): JQuery;
3646
+ filter(func: (this: HTMLElement, index: number, element: Element) => boolean): JQuery;
3596
3647
  /**
3597
3648
  * Reduce the set of matched elements to those that match the selector or pass the function's test.
3598
3649
  *
@@ -3651,7 +3702,7 @@ interface JQuery {
3651
3702
  * @param func A function used as a test for the set of elements. It accepts one argument, index, which is the element's index in the jQuery collection.Within the function, this refers to the current DOM element.
3652
3703
  * @see {@link https://api.jquery.com/is/#is-function}
3653
3704
  */
3654
- is(func: (index: number, element: Element) => boolean): boolean;
3705
+ is(func: (this: HTMLElement, index: number, element: Element) => boolean): boolean;
3655
3706
  /**
3656
3707
  * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.
3657
3708
  *
@@ -3679,7 +3730,7 @@ interface JQuery {
3679
3730
  * @param callback A function object that will be invoked for each element in the current set.
3680
3731
  * @see {@link https://api.jquery.com/map/}
3681
3732
  */
3682
- map(callback: (index: number, domElement: Element) => any): JQuery;
3733
+ map(callback: (this: HTMLElement, index: number, domElement: Element) => any): JQuery;
3683
3734
 
3684
3735
  /**
3685
3736
  * Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.
@@ -3869,14 +3920,14 @@ interface JQuery {
3869
3920
  * @param newQueue An array of functions to replace the current queue contents.
3870
3921
  * @see {@link https://api.jquery.com/queue/#queue-queueName-newQueue}
3871
3922
  */
3872
- queue(newQueue: Function[]): JQuery;
3923
+ queue(newQueue: BoundFunction[]): JQuery;
3873
3924
  /**
3874
3925
  * Manipulate the queue of functions to be executed, once for each matched element.
3875
3926
  *
3876
3927
  * @param callback The new function to add to the queue, with a function to call that will dequeue the next item.
3877
3928
  * @see {@link https://api.jquery.com/queue/#queue-queueName-callback}
3878
3929
  */
3879
- queue(callback: Function): JQuery;
3930
+ queue(callback: BoundFunction): JQuery;
3880
3931
  /**
3881
3932
  * Manipulate the queue of functions to be executed, once for each matched element.
3882
3933
  *
@@ -3884,7 +3935,7 @@ interface JQuery {
3884
3935
  * @param newQueue An array of functions to replace the current queue contents.
3885
3936
  * @see {@link https://api.jquery.com/queue/#queue-queueName-newQueue}
3886
3937
  */
3887
- queue(queueName: string, newQueue: Function[]): JQuery;
3938
+ queue(queueName: string, newQueue: BoundFunction[]): JQuery;
3888
3939
  /**
3889
3940
  * Manipulate the queue of functions to be executed, once for each matched element.
3890
3941
  *
@@ -3892,7 +3943,7 @@ interface JQuery {
3892
3943
  * @param callback The new function to add to the queue, with a function to call that will dequeue the next item.
3893
3944
  * @see {@link https://api.jquery.com/queue/#queue-queueName-callback}
3894
3945
  */
3895
- queue(queueName: string, callback: Function): JQuery;
3946
+ queue(queueName: string, callback: BoundFunction): JQuery;
3896
3947
 
3897
3948
  /**
3898
3949
  * Merge the contents of an object onto the jQuery prototype to provide new jQuery instance methods.
@@ -3900,7 +3951,7 @@ interface JQuery {
3900
3951
  * @param object An object to merge onto the jQuery prototype.
3901
3952
  * @see {@link https://api.jquery.com/jQuery.fn.extend/#jQuery-fn-extend-object}
3902
3953
  */
3903
- extend(object: { [method: string]: (...args: any[]) => any }): JQuery;
3954
+ extend(object: { [method: string]: (this: JQuery, ...args: any[]) => any }): JQuery;
3904
3955
  }
3905
3956
  // eslint-disable-next-line @definitelytyped/no-declare-current-package
3906
3957
  declare module "jquery" {