mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
adding JQueryEventObject to all on handlers and fix tests
This commit is contained in:
Vendored
+42
-2
@@ -4517,6 +4517,21 @@ interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement>
|
||||
selector: JQuery.Selector | null,
|
||||
data: TData,
|
||||
handler: JQuery.EventHandler<TElement, TData> | JQuery.EventHandlerBase<any, JQuery.Event<TElement, TData>>): this;
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
|
||||
* @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the
|
||||
* selector is null or omitted, the event is always triggered when it reaches the selected element.
|
||||
* @param data Data to be passed to the handler in event.data when an event is triggered.
|
||||
* @param handler A function to execute when the event is triggered.
|
||||
* @see {@link https://api.jquery.com/on/}
|
||||
* @since 1.7
|
||||
*/
|
||||
on<TData>(events: string,
|
||||
selector: JQuery.Selector | null,
|
||||
data: TData,
|
||||
handler: ((event: JQueryEventObject) => void)): this; // tslint:disable-line:unified-signatures
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
@@ -4532,6 +4547,19 @@ interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement>
|
||||
selector: JQuery.Selector,
|
||||
handler: JQuery.EventHandler<TElement> | JQuery.EventHandlerBase<any, JQuery.Event<TElement>> | false): this;
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
|
||||
* @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the
|
||||
* selector is null or omitted, the event is always triggered when it reaches the selected element.
|
||||
* @param handler A function to execute when the event is triggered.
|
||||
* @see {@link https://api.jquery.com/on/}
|
||||
* @since 1.7
|
||||
*/
|
||||
on(events: string,
|
||||
selector: JQuery.Selector,
|
||||
handler: ((event: JQueryEventObject) => void)): this; // tslint:disable-line:unified-signatures
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
|
||||
@@ -4543,7 +4571,19 @@ interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement>
|
||||
on<TData>(events: string,
|
||||
data: TData,
|
||||
handler: JQuery.EventHandler<TElement, TData> | JQuery.EventHandlerBase<any, JQuery.Event<TElement, TData>>): this;
|
||||
/**
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
|
||||
* @param data Data to be passed to the handler in event.data when an event is triggered.
|
||||
* @param handler A function to execute when the event is triggered.
|
||||
* @see {@link https://api.jquery.com/on/}
|
||||
* @since 1.7
|
||||
*/
|
||||
on<TData>(events: string,
|
||||
data: TData,
|
||||
handler: ((event: JQueryEventObject) => void)): this; // tslint:disable-line:unified-signatures
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
|
||||
@@ -4563,7 +4603,7 @@ interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement>
|
||||
* @since 1.7
|
||||
*/
|
||||
on(events: string,
|
||||
handler: ((event: JQueryEventObject) => void)): this;
|
||||
handler: ((event: JQueryEventObject) => void)): this; // tslint:disable-line:unified-signatures
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
|
||||
@@ -3634,6 +3634,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', 'myData', function(event: JQueryEventObject) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType JQueryEventObject
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
@@ -3650,6 +3658,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', null, 'myData', function(event: JQueryEventObject) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType JQueryEventObject
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', null, 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
@@ -3666,6 +3682,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', function(event: JQueryEventObject) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType JQueryEventObject
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
@@ -3685,6 +3709,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 3, function(event: JQueryEventObject) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType JQueryEventObject
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 3, function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
|
||||
Reference in New Issue
Block a user