UNPKG

42 kBTypeScriptView Raw
1// Project: http://jquery.com/
2// Definitions by: Boris Yankov <https://github.com/borisyankov/>
3// Christian Hoffmeister <https://github.com/choffmeister>
4// Steve Fenton <https://github.com/Steve-Fenton>
5// Diullei Gomes <https://github.com/Diullei>
6// Tass Iliopoulos <https://github.com/tasoili>
7// Jason Swearingen <https://github.com/jasons-novaleaf>
8// Sean Hill <https://github.com/seanski>
9// Guus Goossens <https://github.com/Guuz>
10// Kelly Summerlin <https://github.com/ksummerlin>
11// Basarat Ali Syed <https://github.com/basarat>
12// Nicholas Wolverson <https://github.com/nwolverson>
13// Derek Cicerone <https://github.com/derekcicerone>
14// Andrew Gaspar <https://github.com/AndrewGaspar>
15// Seikichi Kondo <https://github.com/seikichi>
16// Benjamin Jackman <https://github.com/benjaminjackman>
17// Poul Sorensen <https://github.com/s093294>
18// Josh Strobl <https://github.com/JoshStrobl>
19// John Reilly <https://github.com/johnnyreilly/>
20// Dick van den Brink <https://github.com/DickvdBrink>
21// Thomas Schulz <https://github.com/King2500>
22// Leonard Thieu <https://github.com/leonard-thieu>
23// Andre Wiggins <https://github.com/andrewiggins>
24// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
25
26// Definitions copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0480c5ec87fab41aa23047a02b27f0ea71aaf975/types/jquery/v2/index.d.ts
27
28interface JQLite extends JQuery {
29 [index: number]: HTMLElement;
30}
31
32interface JQuery {
33 /**
34 * Adds the specified class(es) to each of the set of matched elements.
35 *
36 * @param className One or more space-separated classes to be added to the class attribute of each matched element.
37 * @see {@link https://api.jquery.com/addClass/#addClass-className}
38 */
39 addClass(className: string): this;
40
41 /**
42 * Insert content, specified by the parameter, after each element in the set of matched elements.
43 *
44 * @param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert after each element in the set of matched elements.
45 * @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements.
46 * @see {@link https://api.jquery.com/after/#after-content-content}
47 */
48 after(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): this;
49 /**
50 * Insert content, specified by the parameter, after each element in the set of matched elements.
51 *
52 * @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.
53 * @see {@link https://api.jquery.com/after/#after-function}
54 */
55 after(func: (index: number, html: string) => string | Element | JQuery): this;
56
57 /**
58 * Insert content, specified by the parameter, to the end of each element in the set of matched elements.
59 *
60 * @param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements.
61 * @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements.
62 * @see {@link https://api.jquery.com/append/#append-content-content}
63 */
64 append(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): this;
65 /**
66 * Insert content, specified by the parameter, to the end of each element in the set of matched elements.
67 *
68 * @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.
69 * @see {@link https://api.jquery.com/append/#append-function}
70 */
71 append(func: (index: number, html: string) => string | Element | JQuery): this;
72
73 /**
74 * Get the value of an attribute for the first element in the set of matched elements.
75 *
76 * @param attributeName The name of the attribute to get.
77 * @see {@link https://api.jquery.com/attr/#attr-attributeName}
78 */
79 attr(attributeName: string): string;
80 /**
81 * Set one or more attributes for the set of matched elements.
82 *
83 * @param attributeName The name of the attribute to set.
84 * @param value A value to set for the attribute. If this is `null`, the attribute will be deleted.
85 * @see {@link https://api.jquery.com/attr/#attr-attributeName-value}
86 */
87 attr(attributeName: string, value: string | number | null): this;
88 /**
89 * Set one or more attributes for the set of matched elements.
90 *
91 * @param attributes An object of attribute-value pairs to set.
92 * @see {@link https://api.jquery.com/attr/#attr-attributes}
93 */
94 attr(attributes: Object): this;
95
96 /**
97 * Attach a handler to an event for the elements.
98 *
99 * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
100 * @param handler A function to execute each time the event is triggered.
101 * @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-handler}
102 */
103 bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): this;
104 /**
105 * Attach a handler to an event for the elements.
106 *
107 * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
108 * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true.
109 * @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-preventBubble}
110 */
111 bind(eventType: string, preventBubble: boolean): this;
112 /**
113 * Attach a handler to an event for the elements.
114 *
115 * @param events An object containing one or more DOM event types and functions to execute for them.
116 * @see {@link https://api.jquery.com/bind/#bind-events}
117 */
118 bind(events: any): this;
119
120 /**
121 * Get the children of each element in the set of matched elements, optionally filtered by a selector.
122 *
123 * @see {@link https://api.jquery.com/children/}
124 */
125 children(): this;
126
127 /**
128 * Create a deep copy of the set of matched elements.
129 *
130 * @param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The default value is false.
131 * @param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false).
132 * @see {@link https://api.jquery.com/clone/}
133 */
134 clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): this;
135
136 /**
137 * Get the children of each element in the set of matched elements, including text and comment nodes.
138 * @see {@link https://api.jquery.com/contents/}
139 */
140 contents(): this;
141
142 /**
143 * Get the value of style properties for the first element in the set of matched elements.
144 *
145 * @param propertyName A CSS property.
146 * @see {@link https://api.jquery.com/css/#css-propertyName}
147 */
148 css(propertyName: string): string;
149 /**
150 * Get the value of style properties for the first element in the set of matched elements.
151 * Results in an object of property-value pairs.
152 *
153 * @param propertyNames An array of one or more CSS properties.
154 * @see {@link https://api.jquery.com/css/#css-propertyNames}
155 */
156 css(propertyNames: string[]): any;
157 /**
158 * Set one or more CSS properties for the set of matched elements.
159 *
160 * @param propertyName A CSS property name.
161 * @param value A value to set for the property.
162 * @see {@link https://api.jquery.com/css/#css-propertyName-value}
163 */
164 css(propertyName: string, value: string | number): this;
165 /**
166 * Set one or more CSS properties for the set of matched elements.
167 *
168 * @param propertyName A CSS property name.
169 * @param value 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.
170 * @see {@link https://api.jquery.com/css/#css-propertyName-function}
171 */
172 css(propertyName: string, value: (index: number, value: string) => string | number): this;
173 /**
174 * Set one or more CSS properties for the set of matched elements.
175 *
176 * @param properties An object of property-value pairs to set.
177 * @see {@link https://api.jquery.com/css/#css-properties}
178 */
179 css(properties: JQLiteCssProperties): this;
180
181 /**
182 * Store arbitrary data associated with the matched elements.
183 *
184 * @param key A string naming the piece of data to set.
185 * @param value The new data value; it can be any JavaScript type including Array or Object.
186 * @see {@link https://api.jquery.com/data/#data-key-value}
187 */
188 data(key: string, value: any): this;
189 /**
190 * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
191 *
192 * @param key Name of the data stored.
193 * @see {@link https://api.jquery.com/data/#data-key}
194 */
195 data(key: string): any;
196 /**
197 * Store arbitrary data associated with the matched elements.
198 *
199 * @param obj An object of key-value pairs of data to update.
200 * @see {@link https://api.jquery.com/data/#data-obj}
201 */
202 data(obj: { [key: string]: any; }): this;
203 /**
204 * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
205 * @see {@link https://api.jquery.com/data/#data}
206 */
207 data(): any;
208
209 /**
210 * Remove the set of matched elements from the DOM.
211 *
212 * @param selector A selector expression that filters the set of matched elements to be removed.
213 * @see {@link https://api.jquery.com/detach/}
214 */
215 detach(selector?: string): this;
216
217 /**
218 * Remove all child nodes of the set of matched elements from the DOM.
219 * @see {@link https://api.jquery.com/empty/}
220 */
221 empty(): this;
222
223 /**
224 * Reduce the set of matched elements to the one at the specified index.
225 *
226 * @param index An integer indicating the 0-based position of the element. OR An integer indicating the position of the element, counting backwards from the last element in the set.
227 * @see {@link https://api.jquery.com/eq/}
228 */
229 eq(index: number): this;
230
231 /**
232 * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.
233 *
234 * @param selector A string containing a selector expression to match elements against.
235 * @see {@link https://api.jquery.com/find/#find-selector}
236 */
237 find(selector: string): this;
238 find(element: any): this;
239 find(obj: JQuery): this;
240
241 /**
242 * Determine whether any of the matched elements are assigned the given class.
243 *
244 * @param className The class name to search for.
245 * @see {@link https://api.jquery.com/hasClass/}
246 */
247 hasClass(className: string): boolean;
248
249 /**
250 * Get the HTML contents of the first element in the set of matched elements.
251 * @see {@link https://api.jquery.com/html/#html}
252 */
253 html(): string;
254 /**
255 * Set the HTML contents of each element in the set of matched elements.
256 *
257 * @param htmlString A string of HTML to set as the content of each matched element.
258 * @see {@link https://api.jquery.com/html/#html-htmlString}
259 */
260 html(htmlString: string): this;
261 /**
262 * Set the HTML contents of each element in the set of matched elements.
263 *
264 * @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set.
265 * @see {@link https://api.jquery.com/html/#html-function}
266 */
267 html(func: (index: number, oldhtml: string) => string): this;
268
269 /**
270 * 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.
271 *
272 * @see {@link https://api.jquery.com/next/}
273 */
274 next(): this;
275
276 /**
277 * Attach an event handler function for one or more events to the selected elements.
278 *
279 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
280 * @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).
281 * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
282 */
283 on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): this;
284 /**
285 * Attach an event handler function for one or more events to the selected elements.
286 *
287 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
288 * @param data Data to be passed to the handler in event.data when an event is triggered.
289 * @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.
290 * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
291 */
292 on(events: string, data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): this;
293 /**
294 * Attach an event handler function for one or more events to the selected elements.
295 *
296 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
297 * @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.
298 * @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.
299 * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
300 */
301 on(events: string, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): this;
302 /**
303 * Attach an event handler function for one or more events to the selected elements.
304 *
305 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
306 * @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.
307 * @param data Data to be passed to the handler in event.data when an event is triggered.
308 * @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.
309 * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
310 */
311 on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): this;
312 /**
313 * Attach an event handler function for one or more events to the selected elements.
314 *
315 * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
316 * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element.
317 * @param data Data to be passed to the handler in event.data when an event occurs.
318 * @see {@link https://api.jquery.com/on/#on-events-selector-data}
319 */
320 on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, selector?: string, data?: any): this;
321 /**
322 * Attach an event handler function for one or more events to the selected elements.
323 *
324 * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
325 * @param data Data to be passed to the handler in event.data when an event occurs.
326 * @see {@link https://api.jquery.com/on/#on-events-selector-data}
327 */
328 on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, data?: any): this;
329
330 /**
331 * Remove an event handler.
332 * @see {@link https://api.jquery.com/off/#off}
333 */
334 off(): this;
335 /**
336 * Remove an event handler.
337 *
338 * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".
339 * @param selector A selector which should match the one originally passed to .on() when attaching event handlers.
340 * @param handler A handler function previously attached for the event(s), or the special value false.
341 * @see {@link https://api.jquery.com/off/#off-events-selector-handler}
342 */
343 off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): this;
344 /**
345 * Remove an event handler.
346 *
347 * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".
348 * @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().
349 * @see {@link https://api.jquery.com/off/#off-events-selector-handler}
350 */
351 off(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): this;
352 /**
353 * Remove an event handler.
354 *
355 * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".
356 * @param handler A handler function previously attached for the event(s), or the special value false.
357 * @see {@link https://api.jquery.com/off/#off-events-selector-handler}
358 */
359 off(events: string, handler: (eventObject: JQueryEventObject) => any): this;
360 /**
361 * Remove an event handler.
362 *
363 * @param events An object where the string keys represent one or more space-separated event types and optional namespaces, and the values represent handler functions previously attached for the event(s).
364 * @param selector A selector which should match the one originally passed to .on() when attaching event handlers.
365 * @see {@link https://api.jquery.com/off/#off-events-selector}
366 */
367 off(events: { [key: string]: any; }, selector?: string): this;
368
369 /**
370 * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
371 *
372 * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
373 * @param handler A function to execute at the time the event is triggered.
374 * @see {@link https://api.jquery.com/one/#one-events-data-handler}
375 */
376 one(events: string, handler: (eventObject: JQueryEventObject) => any): this;
377 /**
378 * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
379 *
380 * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
381 * @param data An object containing data that will be passed to the event handler.
382 * @param handler A function to execute at the time the event is triggered.
383 * @see {@link https://api.jquery.com/one/#one-events-data-handler}
384 */
385 one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): this;
386 /**
387 * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
388 *
389 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
390 * @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.
391 * @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.
392 * @see {@link https://api.jquery.com/one/#one-events-selector-data-handler}
393 */
394 one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): this;
395 /**
396 * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
397 *
398 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
399 * @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.
400 * @param data Data to be passed to the handler in event.data when an event is triggered.
401 * @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.
402 * @see {@link https://api.jquery.com/one/#one-events-selector-data-handler}
403 */
404 one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): this;
405 /**
406 * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
407 *
408 * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
409 * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element.
410 * @param data Data to be passed to the handler in event.data when an event occurs.
411 * @see {@link https://api.jquery.com/one/#one-events-selector-data}
412 */
413 one(events: { [key: string]: any; }, selector?: string, data?: any): this;
414 /**
415 * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
416 *
417 * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
418 * @param data Data to be passed to the handler in event.data when an event occurs.
419 * @see {@link https://api.jquery.com/one/#one-events-selector-data}
420 */
421 one(events: { [key: string]: any; }, data?: any): this;
422
423 /**
424 * Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
425 *
426 * @see {@link https://api.jquery.com/parent/}
427 */
428 parent(): this;
429
430 /**
431 * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
432 *
433 * @param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements.
434 * @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements.
435 * @see {@link https://api.jquery.com/prepend/#prepend-content-content}
436 */
437 prepend(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): this;
438 /**
439 * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
440 *
441 * @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.
442 * @see {@link https://api.jquery.com/prepend/#prepend-function}
443 */
444 prepend(func: (index: number, html: string) => string | Element | JQuery): this;
445
446 /**
447 * Get the value of a property for the first element in the set of matched elements.
448 *
449 * @param propertyName The name of the property to get.
450 * @see {@link https://api.jquery.com/prop/#prop-propertyName}
451 */
452 prop(propertyName: string): any;
453 /**
454 * Set one or more properties for the set of matched elements.
455 *
456 * @param propertyName The name of the property to set.
457 * @param value A value to set for the property.
458 * @see {@link https://api.jquery.com/prop/#prop-propertyName-value}
459 */
460 prop(propertyName: string, value: string | number | boolean): this;
461 /**
462 * Set one or more properties for the set of matched elements.
463 *
464 * @param properties An object of property-value pairs to set.
465 * @see {@link https://api.jquery.com/prop/#prop-properties}
466 */
467 prop(properties: Object): this;
468 /**
469 * Set one or more properties for the set of matched elements.
470 *
471 * @param propertyName The name of the property to set.
472 * @param func A function returning the value to set. Receives the index position of the element in the set and the old property value as arguments. Within the function, the keyword this refers to the current element.
473 * @see {@link https://api.jquery.com/prop/#prop-propertyName-function}
474 */
475 prop(propertyName: string, func: (index: number, oldPropertyValue: any) => any): this;
476
477 /**
478 * Specify a function to execute when the DOM is fully loaded.
479 *
480 * @param handler A function to execute after the DOM is ready.
481 * @see {@link https://api.jquery.com/ready/}
482 */
483 ready(handler: (jQueryAlias?: JQueryStatic) => any): this;
484
485 /**
486 * Remove the set of matched elements from the DOM.
487 *
488 * @param selector A selector expression that filters the set of matched elements to be removed.
489 * @see {@link https://api.jquery.com/remove/}
490 */
491 remove(selector?: string): this;
492
493 /**
494 * Remove an attribute from each element in the set of matched elements.
495 *
496 * @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes.
497 * @see {@link https://api.jquery.com/removeAttr/}
498 */
499 removeAttr(attributeName: string): this;
500
501 /**
502 * Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
503 *
504 * @param className One or more space-separated classes to be removed from the class attribute of each matched element.
505 * @see {@link https://api.jquery.com/removeClass/#removeClass-className}
506 */
507 removeClass(className?: string): this;
508
509 /**
510 * Remove a previously-stored piece of data.
511 *
512 * @param name A string naming the piece of data to delete or space-separated string naming the pieces of data to delete.
513 * @see {@link https://api.jquery.com/removeData/#removeData-name}
514 */
515 removeData(name: string): this;
516 /**
517 * Remove a previously-stored piece of data.
518 *
519 * @param list An array of strings naming the pieces of data to delete.
520 * @see {@link https://api.jquery.com/removeData/#removeData-list}
521 */
522 removeData(list: string[]): this;
523 /**
524 * Remove all previously-stored piece of data.
525 * @see {@link https://api.jquery.com/removeData/}
526 */
527 removeData(): this;
528
529 /**
530 * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed.
531 *
532 * @param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object.
533 * @see {@link https://api.jquery.com/replaceWith/#replaceWith-newContent}
534 */
535 replaceWith(newContent: JQuery | any[] | Element | Text | string): this;
536 /**
537 * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed.
538 *
539 * @param func A function that returns content with which to replace the set of matched elements.
540 * @see {@link https://api.jquery.com/replaceWith/#replaceWith-function}
541 */
542 replaceWith(func: () => Element | JQuery): this;
543
544 /**
545 * Get the combined text contents of each element in the set of matched elements, including their descendants.
546 * @see {@link https://api.jquery.com/text/#text}
547 */
548 text(): string;
549 /**
550 * Set the content of each element in the set of matched elements to the specified text.
551 *
552 * @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will be converted to a String representation.
553 * @see {@link https://api.jquery.com/text/#text-text}
554 */
555 text(text: string | number | boolean): this;
556 /**
557 * Set the content of each element in the set of matched elements to the specified text.
558 *
559 * @param func A function returning the text content to set. Receives the index position of the element in the set and the old text value as arguments.
560 * @see {@link https://api.jquery.com/text/#text-function}
561 */
562 text(func: (index: number, text: string) => string): this;
563
564 /**
565 * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
566 *
567 * @param className One or more class names (separated by spaces) to be toggled for each element in the matched set.
568 * @param swtch A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed.
569 * @see {@link https://api.jquery.com/toggleClass/#toggleClass-className}
570 */
571 toggleClass(className: string, swtch?: boolean): this;
572 /**
573 * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
574 *
575 * @param swtch A boolean value to determine whether the class should be added or removed.
576 * @see {@link https://api.jquery.com/toggleClass/#toggleClass-state}
577 */
578 toggleClass(swtch?: boolean): this;
579
580 /**
581 * Execute all handlers attached to an element for an event.
582 *
583 * @param eventType A string containing a JavaScript event type, such as click or submit.
584 * @param extraParameters An array of additional parameters to pass along to the event handler.
585 * @see {@link https://api.jquery.com/triggerHandler/#triggerHandler-eventType-extraParameters}
586 */
587 triggerHandler(eventType: string, ...extraParameters: any[]): Object;
588 /**
589 * Execute all handlers attached to an element for an event.
590 *
591 * @param event A jQuery.Event object.
592 * @param extraParameters An array of additional parameters to pass along to the event handler.
593 * @see {@link https://api.jquery.com/triggerHandler/#triggerHandler-event-extraParameters}
594 */
595 triggerHandler(event: JQueryEventObject, ...extraParameters: any[]): Object;
596
597 /**
598 * Remove a previously-attached event handler from the elements.
599 *
600 * @param eventType A string containing a JavaScript event type, such as click or submit.
601 * @param handler The function that is to be no longer executed.
602 * @see {@link https://api.jquery.com/unbind/#unbind-eventType-handler}
603 */
604 unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): this;
605 /**
606 * Remove a previously-attached event handler from the elements.
607 *
608 * @param eventType A string containing a JavaScript event type, such as click or submit.
609 * @param fls Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ).
610 * @see {@link https://api.jquery.com/unbind/#unbind-eventType-false}
611 */
612 unbind(eventType: string, fls: boolean): this;
613 /**
614 * Remove a previously-attached event handler from the elements.
615 *
616 * @param evt A JavaScript event object as passed to an event handler.
617 * @see {@link https://api.jquery.com/unbind/#unbind-event}
618 */
619 unbind(evt: any): this;
620
621 /**
622 * Get the current value of the first element in the set of matched elements.
623 * @see {@link https://api.jquery.com/val/#val}
624 */
625 val(): any;
626 /**
627 * Set the value of each element in the set of matched elements.
628 *
629 * @param value A string of text, an array of strings or number corresponding to the value of each matched element to set as selected/checked.
630 * @see {@link https://api.jquery.com/val/#val-value}
631 */
632 val(value: string | string[] | number): this;
633 /**
634 * Set the value of each element in the set of matched elements.
635 *
636 * @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.
637 * @see {@link https://api.jquery.com/val/#val-function}
638 */
639 val(func: (index: number, value: string) => string): this;
640
641 /**
642 * Wrap an HTML structure around each element in the set of matched elements.
643 *
644 * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements.
645 * @see {@link https://api.jquery.com/wrap/#wrap-wrappingElement}
646 */
647 wrap(wrappingElement: JQuery | Element | string): this;
648 /**
649 * Wrap an HTML structure around each element in the set of matched elements.
650 *
651 * @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.
652 * @see {@link https://api.jquery.com/wrap/#wrap-function}
653 */
654 wrap(func: (index: number) => string | JQuery): this;
655
656 // Undocumented
657 length: number;
658
659 // TODO: events, how to define?
660 // $destroy
661
662 controller(name?: string): any;
663 injector(): ng.auto.IInjectorService;
664 /**
665 * Returns the `$scope` of the element.
666 *
667 * **IMPORTANT**: Requires `debugInfoEnabled` to be true.
668 *
669 * See https://docs.angularjs.org/guide/production#disabling-debug-data for more information.
670 */
671 scope<T extends ng.IScope>(): T;
672 /**
673 * Returns the `$scope` of the element.
674 *
675 * **IMPORTANT**: Requires `debugInfoEnabled` to be true.
676 *
677 * See https://docs.angularjs.org/guide/production#disabling-debug-data for more information.
678 */
679 isolateScope<T extends ng.IScope>(): T;
680
681 inheritedData(key: string, value: any): this;
682 inheritedData(obj: { [key: string]: any; }): this;
683 inheritedData(key?: string): any;
684}
685
686interface JQueryStatic {
687 (element: string | Element | Document | Window | JQuery | ArrayLike<Element> | (() => void)): JQLite;
688}
689
690/**
691 * Interface of the JQuery extension of the W3C event object
692 * @see {@link https://api.jquery.com/category/events/event-object/}
693 */
694interface BaseJQueryEventObject extends Event {
695 /**
696 * The current DOM element within the event bubbling phase.
697 * @see {@link https://api.jquery.com/event.currentTarget/}
698 */
699 currentTarget: Element;
700 /**
701 * An optional object of data passed to an event method when the current executing handler is bound.
702 * @see {@link https://api.jquery.com/event.data/}
703 */
704 data: any;
705 /**
706 * The element where the currently-called jQuery event handler was attached.
707 * @see {@link https://api.jquery.com/event.delegateTarget/}
708 */
709 delegateTarget: Element;
710 /**
711 * Returns whether event.preventDefault() was ever called on this event object.
712 * @see {@link https://api.jquery.com/event.isDefaultPrevented/}
713 */
714 isDefaultPrevented(): boolean;
715 /**
716 * Returns whether event.stopImmediatePropagation() was ever called on this event object.
717 * @see {@link https://api.jquery.com/event.isImmediatePropagationStopped/}
718 */
719 isImmediatePropagationStopped(): boolean;
720 /**
721 * Returns whether event.stopPropagation() was ever called on this event object.
722 * @see {@link https://api.jquery.com/event.isPropagationStopped/}
723 */
724 isPropagationStopped(): boolean;
725 /**
726 * The namespace specified when the event was triggered.
727 * @see {@link https://api.jquery.com/event.namespace/}
728 */
729 namespace: string;
730 /**
731 * The browser's original Event object.
732 * @see {@link https://api.jquery.com/category/events/event-object/}
733 */
734 originalEvent: Event;
735 /**
736 * If this method is called, the default action of the event will not be triggered.
737 * @see {@link https://api.jquery.com/event.preventDefault/}
738 */
739 preventDefault(): any;
740 /**
741 * The other DOM element involved in the event, if any.
742 * @see {@link https://api.jquery.com/event.relatedTarget/}
743 */
744 relatedTarget: Element;
745 /**
746 * The last value returned by an event handler that was triggered by this event, unless the value was undefined.
747 * @see {@link https://api.jquery.com/event.result/}
748 */
749 result: any;
750 /**
751 * Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree.
752 * @see {@link https://api.jquery.com/event.stopImmediatePropagation/}
753 */
754 stopImmediatePropagation(): void;
755 /**
756 * Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
757 * @see {@link https://api.jquery.com/event.stopPropagation/}
758 */
759 stopPropagation(): void;
760 /**
761 * The DOM element that initiated the event.
762 * @see {@link https://api.jquery.com/event.target/}
763 */
764 target: Element;
765 /**
766 * The mouse position relative to the left edge of the document.
767 * @see {@link https://api.jquery.com/event.pageX/}
768 */
769 pageX: number;
770 /**
771 * The mouse position relative to the top edge of the document.
772 * @see {@link https://api.jquery.com/event.pageY/}
773 */
774 pageY: number;
775 /**
776 * For key or mouse events, this property indicates the specific key or button that was pressed.
777 * @see {@link https://api.jquery.com/event.which/}
778 */
779 which: number;
780 /**
781 * Indicates whether the META key was pressed when the event fired.
782 * @see {@link https://api.jquery.com/event.metaKey/}
783 */
784 metaKey: boolean;
785}
786
787interface JQueryCustomEventObject extends BaseJQueryEventObject {
788 /**
789 * @see {@link https://api.jquery.com/category/events/event-object/}
790 * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent}
791 */
792 detail?: any;
793}
794
795interface JQueryInputEventObject extends BaseJQueryEventObject {
796 altKey: boolean;
797 ctrlKey: boolean;
798 metaKey: boolean;
799 shiftKey: boolean;
800}
801
802interface JQueryMouseEventObject extends JQueryInputEventObject {
803 button: number;
804 clientX: number;
805 clientY: number;
806 offsetX: number;
807 offsetY: number;
808 pageX: number;
809 pageY: number;
810 screenX: number;
811 screenY: number;
812}
813
814interface JQueryKeyEventObject extends JQueryInputEventObject {
815 /** @deprecated */
816 char: string;
817 /** @deprecated */
818 charCode: number;
819 key: string;
820 /** @deprecated */
821 keyCode: number;
822}
823
824interface JQueryEventObject extends BaseJQueryEventObject, JQueryCustomEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject {
825}
826
827/**
828 * The interface used to specify the properties parameter in css()
829 */
830// tslint:disable-next-line:class-name
831interface cssPropertySetter {
832 (index: number, value?: string): string | number;
833}
834interface JQLiteCssProperties {
835 [propertyName: string]: string | number | cssPropertySetter;
836}
837
\No newline at end of file