UNPKG

120 kBTypeScriptView Raw
1// Type definitions for chai-jquery 1.1.1
2// Project: https://github.com/chaijs/chai-jquery
3// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5// TypeScript Version: 3.0
6
7/// <reference types="chai" />
8/// <reference types="jquery" />
9
10declare namespace Chai {
11 interface Assertion {
12 attr(name: string, value?: string): Assertion;
13 prop(name: string, value?: any): Assertion;
14 css(name: string, value?: string): Assertion;
15 data(name: string, value?: string): Assertion;
16 class(className: string): Assertion;
17 id(id: string): Assertion;
18 html(html: string): Assertion;
19 text(text: string): Assertion;
20 value(text: string): Assertion;
21 descendants(selector: string): Assertion;
22 visible(): Assertion;
23 hidden(): Assertion;
24 selected(): Assertion;
25 checked(): Assertion;
26 disabled(): Assertion;
27 enabled(): Assertion;
28 (selector: string): Assertion;
29 }
30
31 interface Match {
32 (selector: string): Assertion;
33 }
34}
35
36/**
37 * Static members of chai-jquery (those on $ and jQuery themselves)
38 */
39interface ChaiJQueryStatic {
40 /**
41 * Perform an asynchronous HTTP (Ajax) request.
42 *
43 * @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().
44 */
45 ajax(settings: JQueryAjaxSettings): JQueryXHR;
46 /**
47 * Perform an asynchronous HTTP (Ajax) request.
48 *
49 * @param url A string containing the URL to which the request is sent.
50 * @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().
51 */
52 ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR;
53
54 /**
55 * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().
56 *
57 * @param dataTypes An optional string containing one or more space-separated dataTypes
58 * @param handler A handler to set default values for future Ajax requests.
59 */
60 ajaxPrefilter(
61 dataTypes: string,
62 handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any,
63 ): void;
64 /**
65 * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().
66 *
67 * @param handler A handler to set default values for future Ajax requests.
68 */
69 ajaxPrefilter(handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void;
70
71 ajaxSettings: JQueryAjaxSettings;
72
73 /**
74 * Set default values for future Ajax requests. Its use is not recommended.
75 *
76 * @param options A set of key/value pairs that configure the default Ajax request. All options are optional.
77 */
78 ajaxSetup(options: JQueryAjaxSettings): void;
79
80 /**
81 * Load data from the server using a HTTP GET request.
82 *
83 * @param url A string containing the URL to which the request is sent.
84 * @param success A callback function that is executed if the request succeeds.
85 * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).
86 */
87 get(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
88 /**
89 * Load data from the server using a HTTP GET request.
90 *
91 * @param url A string containing the URL to which the request is sent.
92 * @param data A plain object or string that is sent to the server with the request.
93 * @param success A callback function that is executed if the request succeeds.
94 * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).
95 */
96 get(
97 url: string,
98 data?: Object | string,
99 success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any,
100 dataType?: string,
101 ): JQueryXHR;
102 /**
103 * Load JSON-encoded data from the server using a GET HTTP request.
104 *
105 * @param url A string containing the URL to which the request is sent.
106 * @param success A callback function that is executed if the request succeeds.
107 */
108 getJSON(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
109 /**
110 * Load JSON-encoded data from the server using a GET HTTP request.
111 *
112 * @param url A string containing the URL to which the request is sent.
113 * @param data A plain object or string that is sent to the server with the request.
114 * @param success A callback function that is executed if the request succeeds.
115 */
116 getJSON(
117 url: string,
118 data?: Object | string,
119 success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any,
120 ): JQueryXHR;
121 /**
122 * Load a JavaScript file from the server using a GET HTTP request, then execute it.
123 *
124 * @param url A string containing the URL to which the request is sent.
125 * @param success A callback function that is executed if the request succeeds.
126 */
127 getScript(url: string, success?: (script: string, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
128
129 /**
130 * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request.
131 */
132 param: JQueryParam;
133
134 /**
135 * Load data from the server using a HTTP POST request.
136 *
137 * @param url A string containing the URL to which the request is sent.
138 * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case.
139 * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
140 */
141 post(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
142 /**
143 * Load data from the server using a HTTP POST request.
144 *
145 * @param url A string containing the URL to which the request is sent.
146 * @param data A plain object or string that is sent to the server with the request.
147 * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case.
148 * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
149 */
150 post(
151 url: string,
152 data?: Object | string,
153 success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any,
154 dataType?: string,
155 ): JQueryXHR;
156
157 /**
158 * A multi-purpose callbacks list object that provides a powerful way to manage callback lists.
159 *
160 * @param flags An optional list of space-separated flags that change how the callback list behaves.
161 */
162 Callbacks(flags?: string): JQueryCallback;
163
164 /**
165 * Holds or releases the execution of jQuery's ready event.
166 *
167 * @param hold Indicates whether the ready hold is being requested or released
168 */
169 holdReady(hold: boolean): void;
170
171 /**
172 * Accepts a string containing a CSS selector which is then used to match a set of elements.
173 *
174 * @param selector A string containing a selector expression
175 * @param context A DOM Element, Document, or jQuery to use as context
176 */
177 (selector: string, context?: Element | JQuery): ChaiJQuery;
178 /**
179 * Accepts a string containing a CSS selector which is then used to match a set of elements.
180 *
181 * @param element A DOM element to wrap in a jQuery object.
182 */
183 (element: Element): ChaiJQuery;
184 /**
185 * Accepts a string containing a CSS selector which is then used to match a set of elements.
186 *
187 * @param elementArray An array containing a set of DOM elements to wrap in a jQuery object.
188 */
189 (elementArray: Element[]): ChaiJQuery;
190 /**
191 * Accepts a string containing a CSS selector which is then used to match a set of elements.
192 *
193 * @param object A plain object to wrap in a jQuery object.
194 */
195 (object: {}): ChaiJQuery;
196 /**
197 * Accepts a string containing a CSS selector which is then used to match a set of elements.
198 *
199 * @param object An existing jQuery object to clone.
200 */
201 (object: JQuery): ChaiJQuery;
202 /**
203 * Specify a function to execute when the DOM is fully loaded.
204 */
205 (): ChaiJQuery;
206
207 /**
208 * Creates DOM elements on the fly from the provided string of raw HTML.
209 *
210 * @param html A string of HTML to create on the fly. Note that this parses HTML, not XML.
211 * @param ownerDocument A document in which the new elements will be created.
212 */
213 (html: string, ownerDocument?: Document): ChaiJQuery;
214 /**
215 * Creates DOM elements on the fly from the provided string of raw HTML.
216 *
217 * @param html A string defining a single, standalone, HTML element (e.g. <div/> or <div></div>).
218 * @param attributes An object of attributes, events, and methods to call on the newly-created element.
219 */
220 (html: string, attributes: Object): ChaiJQuery;
221
222 /**
223 * Binds a function to be executed when the DOM has finished loading.
224 *
225 * @param callback A function to execute after the DOM is ready.
226 */
227 (callback: Function): ChaiJQuery;
228
229 /**
230 * Relinquish jQuery's control of the $ variable.
231 *
232 * @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself).
233 */
234 noConflict(removeAll?: boolean): Object;
235
236 /**
237 * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
238 *
239 * @param deferreds One or more Deferred objects, or plain JavaScript objects.
240 */
241 when<T>(...deferreds: Array<T | JQueryPromise<T> /* as JQueryDeferred<T> */>): JQueryPromise<T>;
242
243 /**
244 * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties.
245 */
246 cssHooks: { [key: string]: any };
247 cssNumber: any;
248
249 /**
250 * Store arbitrary data associated with the specified element. Returns the value that was set.
251 *
252 * @param element The DOM element to associate with the data.
253 * @param key A string naming the piece of data to set.
254 * @param value The new data value.
255 */
256 data<T>(element: Element, key: string, value: T): T;
257 /**
258 * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element.
259 *
260 * @param element The DOM element to associate with the data.
261 * @param key A string naming the piece of data to set.
262 */
263 data(element: Element, key: string): any;
264 /**
265 * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element.
266 *
267 * @param element The DOM element to associate with the data.
268 */
269 data(element: Element): any;
270
271 /**
272 * Execute the next function on the queue for the matched element.
273 *
274 * @param element A DOM element from which to remove and execute a queued function.
275 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
276 */
277 dequeue(element: Element, queueName?: string): void;
278
279 /**
280 * Determine whether an element has any jQuery data associated with it.
281 *
282 * @param element A DOM element to be checked for data.
283 */
284 hasData(element: Element): boolean;
285
286 /**
287 * Show the queue of functions to be executed on the matched element.
288 *
289 * @param element A DOM element to inspect for an attached queue.
290 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
291 */
292 queue(element: Element, queueName?: string): any[];
293 /**
294 * Manipulate the queue of functions to be executed on the matched element.
295 *
296 * @param element A DOM element where the array of queued functions is attached.
297 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
298 * @param newQueue An array of functions to replace the current queue contents.
299 */
300 queue(element: Element, queueName: string, newQueue: Function[]): ChaiJQuery;
301 /**
302 * Manipulate the queue of functions to be executed on the matched element.
303 *
304 * @param element A DOM element on which to add a queued function.
305 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
306 * @param callback The new function to add to the queue.
307 */
308 queue(element: Element, queueName: string, callback: Function): ChaiJQuery;
309
310 /**
311 * Remove a previously-stored piece of data.
312 *
313 * @param element A DOM element from which to remove data.
314 * @param name A string naming the piece of data to remove.
315 */
316 removeData(element: Element, name?: string): ChaiJQuery;
317
318 /**
319 * A constructor function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function.
320 *
321 * @param beforeStart A function that is called just before the constructor returns.
322 */
323 Deferred<T>(beforeStart?: (deferred: JQueryDeferred<T>) => any): JQueryDeferred<T>;
324
325 /**
326 * Effects
327 */
328 fx: {
329 tick: () => void;
330 /**
331 * The rate (in milliseconds) at which animations fire.
332 */
333 interval: number;
334 stop: () => void;
335 speeds: { slow: number; fast: number };
336 /**
337 * Globally disable all animations.
338 */
339 off: boolean;
340 step: any;
341 };
342
343 /**
344 * Takes a function and returns a new one that will always have a particular context.
345 *
346 * @param fnction The function whose context will be changed.
347 * @param context The object to which the context (this) of the function should be set.
348 * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument.
349 */
350 proxy(fnction: (...args: any[]) => any, context: Object, ...additionalArguments: any[]): any;
351 /**
352 * Takes a function and returns a new one that will always have a particular context.
353 *
354 * @param context The object to which the context (this) of the function should be set.
355 * @param name The name of the function whose context will be changed (should be a property of the context object).
356 * @param additionalArguments Any number of arguments to be passed to the function named in the name argument.
357 */
358 proxy(context: Object, name: string, ...additionalArguments: any[]): any;
359
360 Event: JQueryEventConstructor;
361
362 /**
363 * Takes a string and throws an exception containing it.
364 *
365 * @param message The message to send out.
366 */
367 error(message: any): ChaiJQuery;
368
369 expr: any;
370 fn: any; // TODO: Decide how we want to type this
371
372 isReady: boolean;
373
374 // Properties
375 support: JQuerySupport;
376
377 /**
378 * Check to see if a DOM element is a descendant of another DOM element.
379 *
380 * @param container The DOM element that may contain the other element.
381 * @param contained The DOM element that may be contained by (a descendant of) the other element.
382 */
383 contains(container: Element, contained: Element): boolean;
384
385 /**
386 * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.
387 *
388 * @param collection The object or array to iterate over.
389 * @param callback The function that will be executed on every object.
390 */
391 each<T>(
392 collection: T[],
393 callback: (indexInArray: number, valueOfElement: T) => any,
394 ): any;
395
396 /**
397 * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.
398 *
399 * @param collection The object or array to iterate over.
400 * @param callback The function that will be executed on every object.
401 */
402 each(
403 collection: any,
404 callback: (indexInArray: any, valueOfElement: any) => any,
405 ): any;
406
407 /**
408 * Merge the contents of two or more objects together into the first object.
409 *
410 * @param target An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument.
411 * @param object1 An object containing additional properties to merge in.
412 * @param objectN Additional objects containing properties to merge in.
413 */
414 extend(target: any, object1?: any, ...objectN: any[]): any;
415 /**
416 * Merge the contents of two or more objects together into the first object.
417 *
418 * @param deep If true, the merge becomes recursive (aka. deep copy).
419 * @param target The object to extend. It will receive the new properties.
420 * @param object1 An object containing additional properties to merge in.
421 * @param objectN Additional objects containing properties to merge in.
422 */
423 extend(deep: boolean, target: any, object1?: any, ...objectN: any[]): any;
424
425 /**
426 * Execute some JavaScript code globally.
427 *
428 * @param code The JavaScript code to execute.
429 */
430 globalEval(code: string): any;
431
432 /**
433 * Finds the elements of an array which satisfy a filter function. The original array is not affected.
434 *
435 * @param array The array to search through.
436 * @param func The function to process each item against. The first argument to the function is the item, and the second argument is the index. The function should return a Boolean value. this will be the global window object.
437 * @param invert If "invert" is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false.
438 */
439 grep<T>(array: T[], func: (elementOfArray: T, indexInArray: number) => boolean, invert?: boolean): T[];
440
441 /**
442 * Search for a specified value within an array and return its index (or -1 if not found).
443 *
444 * @param value The value to search for.
445 * @param array An array through which to search.
446 * @param fromIndex The index of the array at which to begin the search. The default is 0, which will search the whole array.
447 */
448 inArray<T>(value: T, array: T[], fromIndex?: number): number;
449
450 /**
451 * Determine whether the argument is an array.
452 *
453 * @param obj Object to test whether or not it is an array.
454 */
455 isArray(obj: any): boolean;
456 /**
457 * Check to see if an object is empty (contains no enumerable properties).
458 *
459 * @param obj The object that will be checked to see if it's empty.
460 */
461 isEmptyObject(obj: any): boolean;
462 /**
463 * Determine if the argument passed is a Javascript function object.
464 *
465 * @param obj Object to test whether or not it is a function.
466 */
467 isFunction(obj: any): boolean;
468 /**
469 * Determines whether its argument is a number.
470 *
471 * @param obj The value to be tested.
472 */
473 isNumeric(value: any): boolean;
474 /**
475 * Check to see if an object is a plain object (created using "{}" or "new Object").
476 *
477 * @param obj The object that will be checked to see if it's a plain object.
478 */
479 isPlainObject(obj: any): boolean;
480 /**
481 * Determine whether the argument is a window.
482 *
483 * @param obj Object to test whether or not it is a window.
484 */
485 isWindow(obj: any): boolean;
486 /**
487 * Check to see if a DOM node is within an XML document (or is an XML document).
488 *
489 * @param node The DOM node that will be checked to see if it's in an XML document.
490 */
491 isXMLDoc(node: Node): boolean;
492
493 /**
494 * Convert an array-like object into a true JavaScript array.
495 *
496 * @param obj Any object to turn into a native Array.
497 */
498 makeArray(obj: any): any[];
499
500 /**
501 * Translate all items in an array or object to new array of items.
502 *
503 * @param array The Array to translate.
504 * @param callback The function to process each item against. The first argument to the function is the array item, the second argument is the index in array The function can return any value. Within the function, this refers to the global (window) object.
505 */
506 map<T, U>(array: T[], callback: (elementOfArray: T, indexInArray: number) => U): U[];
507 /**
508 * Translate all items in an array or object to new array of items.
509 *
510 * @param arrayOrObject The Array or Object to translate.
511 * @param callback The function to process each item against. The first argument to the function is the value; the second argument is the index or key of the array or object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object.
512 */
513 map(arrayOrObject: any, callback: (value: any, indexOrKey: any) => any): any;
514
515 /**
516 * Merge the contents of two arrays together into the first array.
517 *
518 * @param first The first array to merge, the elements of second added.
519 * @param second The second array to merge into the first, unaltered.
520 */
521 merge<T>(first: T[], second: T[]): T[];
522
523 /**
524 * An empty function.
525 */
526 noop(): any;
527
528 /**
529 * Return a number representing the current time.
530 */
531 now(): number;
532
533 /**
534 * Takes a well-formed JSON string and returns the resulting JavaScript object.
535 *
536 * @param json The JSON string to parse.
537 */
538 parseJSON(json: string): any;
539
540 /**
541 * Parses a string into an XML document.
542 *
543 * @param data a well-formed XML string to be parsed
544 */
545 parseXML(data: string): XMLDocument;
546
547 /**
548 * Remove the whitespace from the beginning and end of a string.
549 *
550 * @param str Remove the whitespace from the beginning and end of a string.
551 */
552 trim(str: string): string;
553
554 /**
555 * Determine the internal JavaScript [[Class]] of an object.
556 *
557 * @param obj Object to get the internal JavaScript [[Class]] of.
558 */
559 type(obj: any): string;
560
561 /**
562 * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.
563 *
564 * @param array The Array of DOM elements.
565 */
566 unique(array: Element[]): Element[];
567
568 /**
569 * Parses a string into an array of DOM nodes.
570 *
571 * @param data HTML string to be parsed
572 * @param context DOM element to serve as the context in which the HTML fragment will be created
573 * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string
574 */
575 parseHTML(data: string, context?: HTMLElement, keepScripts?: boolean): any[];
576
577 /**
578 * Parses a string into an array of DOM nodes.
579 *
580 * @param data HTML string to be parsed
581 * @param context DOM element to serve as the context in which the HTML fragment will be created
582 * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string
583 */
584 parseHTML(data: string, context?: Document, keepScripts?: boolean): any[];
585}
586
587/**
588 * The chai-jquery instance members
589 */
590interface ChaiJQuery {
591 /**
592 * Register a handler to be called when Ajax requests complete. This is an AjaxEvent.
593 *
594 * @param handler The function to be invoked.
595 */
596 ajaxComplete(
597 handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: any) => any,
598 ): ChaiJQuery;
599 /**
600 * Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event.
601 *
602 * @param handler The function to be invoked.
603 */
604 ajaxError(
605 handler: (
606 event: JQueryEventObject,
607 jqXHR: JQueryXHR,
608 ajaxSettings: JQueryAjaxSettings,
609 thrownError: any,
610 ) => any,
611 ): ChaiJQuery;
612 /**
613 * Attach a function to be executed before an Ajax request is sent. This is an Ajax Event.
614 *
615 * @param handler The function to be invoked.
616 */
617 ajaxSend(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxOptions: JQueryAjaxSettings) => any): ChaiJQuery;
618 /**
619 * Register a handler to be called when the first Ajax request begins. This is an Ajax Event.
620 *
621 * @param handler The function to be invoked.
622 */
623 ajaxStart(handler: () => any): ChaiJQuery;
624 /**
625 * Register a handler to be called when all Ajax requests have completed. This is an Ajax Event.
626 *
627 * @param handler The function to be invoked.
628 */
629 ajaxStop(handler: () => any): ChaiJQuery;
630 /**
631 * Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event.
632 *
633 * @param handler The function to be invoked.
634 */
635 ajaxSuccess(
636 handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: JQueryAjaxSettings) => any,
637 ): ChaiJQuery;
638
639 /**
640 * Load data from the server and place the returned HTML into the matched element.
641 *
642 * @param url A string containing the URL to which the request is sent.
643 * @param data A plain object or string that is sent to the server with the request.
644 * @param complete A callback function that is executed when the request completes.
645 */
646 load(
647 url: string,
648 data?: string | Object,
649 complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any,
650 ): ChaiJQuery;
651
652 /**
653 * Encode a set of form elements as a string for submission.
654 */
655 serialize(): string;
656 /**
657 * Encode a set of form elements as an array of names and values.
658 */
659 serializeArray(): JQuerySerializeArrayElement[];
660
661 /**
662 * Adds the specified class(es) to each of the set of matched elements.
663 *
664 * @param className One or more space-separated classes to be added to the class attribute of each matched element.
665 */
666 addClass(className: string): ChaiJQuery;
667 /**
668 * Adds the specified class(es) to each of the set of matched elements.
669 *
670 * @param function A function returning one or more space-separated class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, this refers to the current element in the set.
671 */
672 addClass(func: (index: number, className: string) => string): ChaiJQuery;
673
674 /**
675 * Add the previous set of elements on the stack to the current set, optionally filtered by a selector.
676 */
677 addBack(selector?: string): ChaiJQuery;
678
679 /**
680 * Get the value of an attribute for the first element in the set of matched elements.
681 *
682 * @param attributeName The name of the attribute to get.
683 */
684 attr(attributeName: string): string;
685 /**
686 * Set one or more attributes for the set of matched elements.
687 *
688 * @param attributeName The name of the attribute to set.
689 * @param value A value to set for the attribute.
690 */
691 attr(attributeName: string, value: string | number): ChaiJQuery;
692 /**
693 * Set one or more attributes for the set of matched elements.
694 *
695 * @param attributeName The name of the attribute to set.
696 * @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.
697 */
698 attr(attributeName: string, func: (index: number, attr: string) => string | number): ChaiJQuery;
699 /**
700 * Set one or more attributes for the set of matched elements.
701 *
702 * @param attributes An object of attribute-value pairs to set.
703 */
704 attr(attributes: Object): ChaiJQuery;
705
706 /**
707 * Determine whether any of the matched elements are assigned the given class.
708 *
709 * @param className The class name to search for.
710 */
711 hasClass(className: string): boolean;
712
713 /**
714 * Get the HTML contents of the first element in the set of matched elements.
715 */
716 html(): string;
717 /**
718 * Set the HTML contents of each element in the set of matched elements.
719 *
720 * @param htmlString A string of HTML to set as the content of each matched element.
721 */
722 html(htmlString: string): ChaiJQuery;
723 /**
724 * Set the HTML contents of each element in the set of matched elements.
725 *
726 * @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.
727 */
728 html(func: (index: number, oldhtml: string) => string): ChaiJQuery;
729 /**
730 * Set the HTML contents of each element in the set of matched elements.
731 *
732 * @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.
733 */
734
735 /**
736 * Get the value of a property for the first element in the set of matched elements.
737 *
738 * @param propertyName The name of the property to get.
739 */
740 prop(propertyName: string): any;
741 /**
742 * Set one or more properties for the set of matched elements.
743 *
744 * @param propertyName The name of the property to set.
745 * @param value A value to set for the property.
746 */
747 prop(propertyName: string, value: string | number | boolean): ChaiJQuery;
748 /**
749 * Set one or more properties for the set of matched elements.
750 *
751 * @param properties An object of property-value pairs to set.
752 */
753 prop(properties: Object): ChaiJQuery;
754 /**
755 * Set one or more properties for the set of matched elements.
756 *
757 * @param propertyName The name of the property to set.
758 * @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.
759 */
760 prop(propertyName: string, func: (index: number, oldPropertyValue: any) => any): ChaiJQuery;
761
762 /**
763 * Remove an attribute from each element in the set of matched elements.
764 *
765 * @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes.
766 */
767 removeAttr(attributeName: string): ChaiJQuery;
768
769 /**
770 * Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
771 *
772 * @param className One or more space-separated classes to be removed from the class attribute of each matched element.
773 */
774 removeClass(className?: string): ChaiJQuery;
775 /**
776 * Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
777 *
778 * @param function A function returning one or more space-separated class names to be removed. Receives the index position of the element in the set and the old class value as arguments.
779 */
780 removeClass(func: (index: number, className: string) => string): ChaiJQuery;
781
782 /**
783 * Remove a property for the set of matched elements.
784 *
785 * @param propertyName The name of the property to remove.
786 */
787 removeProp(propertyName: string): ChaiJQuery;
788
789 /**
790 * 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.
791 *
792 * @param className One or more class names (separated by spaces) to be toggled for each element in the matched set.
793 * @param swtch A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed.
794 */
795 toggleClass(className: string, swtch?: boolean): ChaiJQuery;
796 /**
797 * 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.
798 *
799 * @param swtch A boolean value to determine whether the class should be added or removed.
800 */
801 toggleClass(swtch?: boolean): ChaiJQuery;
802 /**
803 * 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.
804 *
805 * @param func A function that returns class names to be toggled in the class attribute of each element in the matched set. Receives the index position of the element in the set, the old class value, and the switch as arguments.
806 * @param swtch A boolean value to determine whether the class should be added or removed.
807 */
808 toggleClass(func: (index: number, className: string, swtch: boolean) => string, swtch?: boolean): ChaiJQuery;
809
810 /**
811 * Get the current value of the first element in the set of matched elements.
812 */
813 val(): any;
814 /**
815 * Set the value of each element in the set of matched elements.
816 *
817 * @param value A string of text or an array of strings corresponding to the value of each matched element to set as selected/checked.
818 */
819 val(value: string | string[]): ChaiJQuery;
820 /**
821 * Set the value of each element in the set of matched elements.
822 *
823 * @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.
824 */
825 val(func: (index: number, value: string) => string): ChaiJQuery;
826
827 /**
828 * Get the value of style properties for the first element in the set of matched elements.
829 *
830 * @param propertyName A CSS property.
831 */
832 css(propertyName: string): string;
833 /**
834 * Set one or more CSS properties for the set of matched elements.
835 *
836 * @param propertyName A CSS property name.
837 * @param value A value to set for the property.
838 */
839 css(propertyName: string, value: string | number): ChaiJQuery;
840 /**
841 * Set one or more CSS properties for the set of matched elements.
842 *
843 * @param propertyName A CSS property name.
844 * @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.
845 */
846 css(propertyName: string, value: (index: number, value: string) => string | number): ChaiJQuery;
847 /**
848 * Set one or more CSS properties for the set of matched elements.
849 *
850 * @param properties An object of property-value pairs to set.
851 */
852 css(properties: Object): ChaiJQuery;
853
854 /**
855 * Get the current computed height for the first element in the set of matched elements.
856 */
857 height(): number;
858 /**
859 * Set the CSS height of every matched element.
860 *
861 * @param value An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string).
862 */
863 height(value: number | string): ChaiJQuery;
864 /**
865 * Set the CSS height of every matched element.
866 *
867 * @param func A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set.
868 */
869 height(func: (index: number, height: number) => number | string): ChaiJQuery;
870
871 /**
872 * Get the current computed height for the first element in the set of matched elements, including padding but not border.
873 */
874 innerHeight(): number;
875
876 /**
877 * Sets the inner height on elements in the set of matched elements, including padding but not border.
878 *
879 * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
880 */
881 innerHeight(height: number | string): ChaiJQuery;
882
883 /**
884 * Get the current computed width for the first element in the set of matched elements, including padding but not border.
885 */
886 innerWidth(): number;
887
888 /**
889 * Sets the inner width on elements in the set of matched elements, including padding but not border.
890 *
891 * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
892 */
893 innerWidth(width: number | string): ChaiJQuery;
894
895 /**
896 * Get the current coordinates of the first element in the set of matched elements, relative to the document.
897 */
898 offset(): JQueryCoordinates;
899 /**
900 * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements.
901 *
902 * @param coordinates An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements.
903 */
904 offset(coordinates: JQueryCoordinates): ChaiJQuery;
905 /**
906 * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements.
907 *
908 * @param func A function to return the coordinates to set. Receives the index of the element in the collection as the first argument and the current coordinates as the second argument. The function should return an object with the new top and left properties.
909 */
910 offset(func: (index: number, coords: JQueryCoordinates) => JQueryCoordinates): ChaiJQuery;
911
912 /**
913 * Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns an integer (without "px") representation of the value or null if called on an empty set of elements.
914 *
915 * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation.
916 */
917 outerHeight(includeMargin?: boolean): number;
918
919 /**
920 * Sets the outer height on elements in the set of matched elements, including padding and border.
921 *
922 * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
923 */
924 outerHeight(height: number | string): ChaiJQuery;
925
926 /**
927 * Get the current computed width for the first element in the set of matched elements, including padding and border.
928 *
929 * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation.
930 */
931 outerWidth(includeMargin?: boolean): number;
932
933 /**
934 * Sets the outer width on elements in the set of matched elements, including padding and border.
935 *
936 * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
937 */
938 outerWidth(width: number | string): ChaiJQuery;
939
940 /**
941 * Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.
942 */
943 position(): JQueryCoordinates;
944
945 /**
946 * Get the current horizontal position of the scroll bar for the first element in the set of matched elements or set the horizontal position of the scroll bar for every matched element.
947 */
948 scrollLeft(): number;
949 /**
950 * Set the current horizontal position of the scroll bar for each of the set of matched elements.
951 *
952 * @param value An integer indicating the new position to set the scroll bar to.
953 */
954 scrollLeft(value: number): ChaiJQuery;
955
956 /**
957 * Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element.
958 */
959 scrollTop(): number;
960 /**
961 * Set the current vertical position of the scroll bar for each of the set of matched elements.
962 *
963 * @param value An integer indicating the new position to set the scroll bar to.
964 */
965 scrollTop(value: number): ChaiJQuery;
966
967 /**
968 * Get the current computed width for the first element in the set of matched elements.
969 */
970 width(): number;
971 /**
972 * Set the CSS width of each element in the set of matched elements.
973 *
974 * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
975 */
976 width(value: number | string): ChaiJQuery;
977 /**
978 * Set the CSS width of each element in the set of matched elements.
979 *
980 * @param func A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set.
981 */
982 width(func: (index: number, width: number) => number | string): ChaiJQuery;
983
984 /**
985 * Remove from the queue all items that have not yet been run.
986 *
987 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
988 */
989 clearQueue(queueName?: string): ChaiJQuery;
990
991 /**
992 * Store arbitrary data associated with the matched elements.
993 *
994 * @param key A string naming the piece of data to set.
995 * @param value The new data value; it can be any Javascript type including Array or Object.
996 */
997 data(key: string, value: any): ChaiJQuery;
998 /**
999 * Store arbitrary data associated with the matched elements.
1000 *
1001 * @param obj An object of key-value pairs of data to update.
1002 */
1003 data(obj: { [key: string]: any }): ChaiJQuery;
1004 /**
1005 * 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.
1006 *
1007 * @param key Name of the data stored.
1008 */
1009 data(key: string): any;
1010 /**
1011 * 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.
1012 */
1013 data(): any;
1014
1015 /**
1016 * Execute the next function on the queue for the matched elements.
1017 *
1018 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
1019 */
1020 dequeue(queueName?: string): ChaiJQuery;
1021
1022 /**
1023 * Remove a previously-stored piece of data.
1024 *
1025 * @param name A string naming the piece of data to delete or space-separated string naming the pieces of data to delete.
1026 */
1027 removeData(name: string): ChaiJQuery;
1028 /**
1029 * Remove a previously-stored piece of data.
1030 *
1031 * @param list An array of strings naming the pieces of data to delete.
1032 */
1033 removeData(list: string[]): ChaiJQuery;
1034
1035 /**
1036 * Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished.
1037 *
1038 * @param type The type of queue that needs to be observed. (default: fx)
1039 * @param target Object onto which the promise methods have to be attached
1040 */
1041 promise(type?: string, target?: Object): JQueryPromise<any>;
1042
1043 /**
1044 * Perform a custom animation of a set of CSS properties.
1045 *
1046 * @param properties An object of CSS properties and values that the animation will move toward.
1047 * @param duration A string or number determining how long the animation will run.
1048 * @param complete A function to call once the animation is complete.
1049 */
1050 animate(properties: Object, duration?: string | number, complete?: Function): ChaiJQuery;
1051 /**
1052 * Perform a custom animation of a set of CSS properties.
1053 *
1054 * @param properties An object of CSS properties and values that the animation will move toward.
1055 * @param duration A string or number determining how long the animation will run.
1056 * @param easing A string indicating which easing function to use for the transition. (default: swing)
1057 * @param complete A function to call once the animation is complete.
1058 */
1059 animate(properties: Object, duration?: string | number, easing?: string, complete?: Function): ChaiJQuery;
1060 /**
1061 * Perform a custom animation of a set of CSS properties.
1062 *
1063 * @param properties An object of CSS properties and values that the animation will move toward.
1064 * @param options A map of additional options to pass to the method.
1065 */
1066 animate(properties: Object, options: JQueryAnimationOptions): ChaiJQuery;
1067
1068 /**
1069 * Set a timer to delay execution of subsequent items in the queue.
1070 *
1071 * @param duration An integer indicating the number of milliseconds to delay execution of the next item in the queue.
1072 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
1073 */
1074 delay(duration: number, queueName?: string): ChaiJQuery;
1075
1076 /**
1077 * Display the matched elements by fading them to opaque.
1078 *
1079 * @param duration A string or number determining how long the animation will run.
1080 * @param complete A function to call once the animation is complete.
1081 */
1082 fadeIn(duration?: number | string, complete?: Function): ChaiJQuery;
1083 /**
1084 * Display the matched elements by fading them to opaque.
1085 *
1086 * @param duration A string or number determining how long the animation will run.
1087 * @param easing A string indicating which easing function to use for the transition.
1088 * @param complete A function to call once the animation is complete.
1089 */
1090 fadeIn(duration?: number | string, easing?: string, complete?: Function): ChaiJQuery;
1091 /**
1092 * Display the matched elements by fading them to opaque.
1093 *
1094 * @param options A map of additional options to pass to the method.
1095 */
1096 fadeIn(options: JQueryAnimationOptions): ChaiJQuery;
1097
1098 /**
1099 * Hide the matched elements by fading them to transparent.
1100 *
1101 * @param duration A string or number determining how long the animation will run.
1102 * @param complete A function to call once the animation is complete.
1103 */
1104 fadeOut(duration?: number | string, complete?: Function): ChaiJQuery;
1105 /**
1106 * Hide the matched elements by fading them to transparent.
1107 *
1108 * @param duration A string or number determining how long the animation will run.
1109 * @param easing A string indicating which easing function to use for the transition.
1110 * @param complete A function to call once the animation is complete.
1111 */
1112 fadeOut(duration?: number | string, easing?: string, complete?: Function): ChaiJQuery;
1113 /**
1114 * Hide the matched elements by fading them to transparent.
1115 *
1116 * @param options A map of additional options to pass to the method.
1117 */
1118 fadeOut(options: JQueryAnimationOptions): ChaiJQuery;
1119
1120 /**
1121 * Adjust the opacity of the matched elements.
1122 *
1123 * @param duration A string or number determining how long the animation will run.
1124 * @param opacity A number between 0 and 1 denoting the target opacity.
1125 * @param complete A function to call once the animation is complete.
1126 */
1127 fadeTo(duration: string | number, opacity: number, complete?: Function): ChaiJQuery;
1128 /**
1129 * Adjust the opacity of the matched elements.
1130 *
1131 * @param duration A string or number determining how long the animation will run.
1132 * @param opacity A number between 0 and 1 denoting the target opacity.
1133 * @param easing A string indicating which easing function to use for the transition.
1134 * @param complete A function to call once the animation is complete.
1135 */
1136 fadeTo(duration: string | number, opacity: number, easing?: string, complete?: Function): ChaiJQuery;
1137
1138 /**
1139 * Display or hide the