jquery.d.ts 68 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537
  1. /* *****************************************************************************
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  4. this file except in compliance with the License. You may obtain a copy of the
  5. License at http://www.apache.org/licenses/LICENSE-2.0
  6. THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  7. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  8. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  9. MERCHANTABLITY OR NON-INFRINGEMENT.
  10. See the Apache Version 2.0 License for specific language governing permissions
  11. and limitations under the License.
  12. ***************************************************************************** */
  13. // Typing for the jQuery library, version 1.10.x / 2.0.x
  14. // Project: http://jquery.com/
  15. // Definitions by: Boris Yankov <https://github.com/borisyankov/>, Christian Hoffmeister <https://github.com/choffmeister>, Steve Fenton, Diullei Gomes <https://github.com/Diullei>, Tass Iliopoulos <https://github.com/tasoili>, Jason Swearingen, Sean Hill <https://github.com/seanski>, Guus Goossens <https://github.com/Guuz>, Kelly Summerlin <https://github.com/ksummerlin>, Basarat Ali Syed <https://github.com/basarat>, Nicholas Wolverson <https://github.com/nwolverson>, Derek Cicerone <https://github.com/derekcicerone>, Andrew Gaspar <https://github.com/AndrewGaspar>, James Harrison Fisher <https://github.com/jameshfisher>, Seikichi Kondo <https://github.com/seikichi>, Benjamin Jackman <https://github.com/benjaminjackman>, Poul Sorensen <https://github.com/s093294>, Josh Strobl <https://github.com/JoshStrobl>, John Reilly <https://github.com/johnnyreilly/>
  16. // Definitions: https://github.com/borisyankov/DefinitelyTyped
  17. /*
  18. Interface for the AJAX setting that will configure the AJAX request
  19. */
  20. interface JQueryAjaxSettings {
  21. /**
  22. * The content type sent in the request header that tells the server what kind of response it will accept in return. If the accepts setting needs modification, it is recommended to do so once in the $.ajaxSetup() method.
  23. */
  24. accepts?: any;
  25. /**
  26. * By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback options instead of the corresponding methods of the jqXHR object such as jqXHR.done() or the deprecated jqXHR.success().
  27. */
  28. async?: boolean;
  29. /**
  30. * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless of the type of request.
  31. */
  32. beforeSend? (jqXHR: JQueryXHR, settings: JQueryAjaxSettings): any;
  33. /**
  34. * If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET.
  35. */
  36. cache?: boolean;
  37. /**
  38. * A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request ("success", "notmodified", "error", "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event.
  39. */
  40. complete? (jqXHR: JQueryXHR, textStatus: string): any;
  41. /**
  42. * An object of string/regular-expression pairs that determine how jQuery will parse the response, given its content type. (version added: 1.5)
  43. */
  44. contents?: { [key: string]: any; };
  45. //According to jQuery.ajax source code, ajax's option actually allows contentType to set to "false"
  46. // https://github.com/borisyankov/DefinitelyTyped/issues/742
  47. /**
  48. * When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding.
  49. */
  50. contentType?: any;
  51. /**
  52. * This object will be made the context of all Ajax-related callbacks. By default, the context is an object that represents the ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax).
  53. */
  54. context?: any;
  55. /**
  56. * An object containing dataType-to-dataType converters. Each converter's value is a function that returns the transformed value of the response. (version added: 1.5)
  57. */
  58. converters?: { [key: string]: any; };
  59. /**
  60. * If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true. This allows, for example, server-side redirection to another domain. (version added: 1.5)
  61. */
  62. crossDomain?: boolean;
  63. /**
  64. * Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below).
  65. */
  66. data?: any;
  67. /**
  68. * A function to be used to handle the raw response data of XMLHttpRequest.This is a pre-filtering function to sanitize the response. You should return the sanitized data. The function accepts two arguments: The raw data returned from the server and the 'dataType' parameter.
  69. */
  70. dataFilter? (data: any, ty: any): any;
  71. /**
  72. * The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string).
  73. */
  74. dataType?: string;
  75. /**
  76. * A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event.
  77. */
  78. error? (jqXHR: JQueryXHR, textStatus: string, errorThrow: string): any;
  79. /**
  80. * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events.
  81. */
  82. global?: boolean;
  83. /**
  84. * An object of additional header key/value pairs to send along with requests using the XMLHttpRequest transport. The header X-Requested-With: XMLHttpRequest is always added, but its default XMLHttpRequest value can be changed here. Values in the headers setting can also be overwritten from within the beforeSend function. (version added: 1.5)
  85. */
  86. headers?: { [key: string]: any; };
  87. /**
  88. * Allow the request to be successful only if the response has changed since the last request. This is done by checking the Last-Modified header. Default value is false, ignoring the header. In jQuery 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data.
  89. */
  90. ifModified?: boolean;
  91. /**
  92. * Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery does not recognize it as such by default. The following protocols are currently recognized as local: file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so once in the $.ajaxSetup() method. (version added: 1.5.1)
  93. */
  94. isLocal?: boolean;
  95. /**
  96. * Override the callback function name in a jsonp request. This value will be used instead of 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for transformation. In this case, you should also explicitly set the jsonpCallback setting. For example, { jsonp: false, jsonpCallback: "callbackName" }
  97. */
  98. jsonp?: string;
  99. /**
  100. * Specify the callback function name for a JSONP request. This value will be used instead of the random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name as it'll make it easier to manage the requests and provide callbacks and error handling. You may want to specify the callback when you want to enable better browser caching of GET requests. As of jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback is set to the return value of that function.
  101. */
  102. jsonpCallback?: any;
  103. /**
  104. * A mime type to override the XHR mime type. (version added: 1.5.1)
  105. */
  106. mimeType?: string;
  107. /**
  108. * A password to be used with XMLHttpRequest in response to an HTTP access authentication request.
  109. */
  110. password?: string;
  111. /**
  112. * By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, set this option to false.
  113. */
  114. processData?: boolean;
  115. /**
  116. * Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request. Used when the character set on the local page is not the same as the one on the remote script.
  117. */
  118. scriptCharset?: string;
  119. /**
  120. * An object of numeric HTTP codes and functions to be called when the response has the corresponding code. f the request is successful, the status code functions take the same parameters as the success callback; if it results in an error (including 3xx redirect), they take the same parameters as the error callback. (version added: 1.5)
  121. */
  122. statusCode?: { [key: string]: any; };
  123. /**
  124. * A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event.
  125. */
  126. success? (data: any, textStatus: string, jqXHR: JQueryXHR): any;
  127. /**
  128. * Set a timeout (in milliseconds) for the request. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period.
  129. */
  130. timeout?: number;
  131. /**
  132. * Set this to true if you wish to use the traditional style of param serialization.
  133. */
  134. traditional?: boolean;
  135. /**
  136. * The type of request to make ("POST" or "GET"), default is "GET". Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers.
  137. */
  138. type?: string;
  139. /**
  140. * A string containing the URL to which the request is sent.
  141. */
  142. url?: string;
  143. /**
  144. * A username to be used with XMLHttpRequest in response to an HTTP access authentication request.
  145. */
  146. username?: string;
  147. /**
  148. * Callback for creating the XMLHttpRequest object. Defaults to the ActiveXObject when available (IE), the XMLHttpRequest otherwise. Override to provide your own implementation for XMLHttpRequest or enhancements to the factory.
  149. */
  150. xhr?: any;
  151. /**
  152. * An object of fieldName-fieldValue pairs to set on the native XHR object. For example, you can use it to set withCredentials to true for cross-domain requests if needed. In jQuery 1.5, the withCredentials property was not propagated to the native XHR and thus CORS requests requiring it would ignore this flag. For this reason, we recommend using jQuery 1.5.1+ should you require the use of it. (version added: 1.5.1)
  153. */
  154. xhrFields?: { [key: string]: any; };
  155. }
  156. /*
  157. Interface for the jqXHR object
  158. */
  159. interface JQueryXHR extends XMLHttpRequest, JQueryPromise<any> {
  160. overrideMimeType(mimeType: string): any;
  161. abort(statusText?: string): void;
  162. }
  163. /*
  164. Interface for the JQuery callback
  165. */
  166. interface JQueryCallback {
  167. add(...callbacks: any[]): any;
  168. disable(): any;
  169. empty(): any;
  170. fire(...arguments: any[]): any;
  171. fired(): boolean;
  172. fireWith(context: any, ...args: any[]): any;
  173. has(callback: any): boolean;
  174. lock(): any;
  175. locked(): boolean;
  176. remove(...callbacks: any[]): any;
  177. }
  178. /*
  179. Allows jQuery Promises to interop with non-jQuery promises
  180. */
  181. interface JQueryGenericPromise<T> {
  182. then<U>(onFulfill: (value: T) => U, onReject?: (reason: any) => U): JQueryGenericPromise<U>;
  183. then<U>(onFulfill: (value: T) => JQueryGenericPromise<U>, onReject?: (reason: any) => U): JQueryGenericPromise<U>;
  184. then<U>(onFulfill: (value: T) => U, onReject?: (reason: any) => JQueryGenericPromise<U>): JQueryGenericPromise<U>;
  185. then<U>(onFulfill: (value: T) => JQueryGenericPromise<U>, onReject?: (reason: any) => JQueryGenericPromise<U>): JQueryGenericPromise<U>;
  186. }
  187. /*
  188. Interface for the JQuery promise, part of callbacks
  189. */
  190. interface JQueryPromise<T> {
  191. // Generic versions of callbacks
  192. always(...alwaysCallbacks: T[]): JQueryPromise<T>;
  193. done(...doneCallbacks: T[]): JQueryPromise<T>;
  194. fail(...failCallbacks: T[]): JQueryPromise<T>;
  195. progress(...progressCallbacks: T[]): JQueryPromise<T>;
  196. always(...alwaysCallbacks: any[]): JQueryPromise<T>;
  197. done(...doneCallbacks: any[]): JQueryPromise<T>;
  198. fail(...failCallbacks: any[]): JQueryPromise<T>;
  199. progress(...progressCallbacks: any[]): JQueryPromise<T>;
  200. // Deprecated - given no typings
  201. pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise<any>;
  202. then<U>(onFulfill: (value: T) => U, onReject?: (...reasons: any[]) => U, onProgress?: (...progression: any[]) => any): JQueryPromise<U>;
  203. then<U>(onFulfill: (value: T) => JQueryGenericPromise<U>, onReject?: (...reasons: any[]) => U, onProgress?: (...progression: any[]) => any): JQueryPromise<U>;
  204. then<U>(onFulfill: (value: T) => U, onReject?: (...reasons: any[]) => JQueryGenericPromise<U>, onProgress?: (...progression: any[]) => any): JQueryPromise<U>;
  205. then<U>(onFulfill: (value: T) => JQueryGenericPromise<U>, onReject?: (...reasons: any[]) => JQueryGenericPromise<U>, onProgress?: (...progression: any[]) => any): JQueryPromise<U>;
  206. // Because JQuery Promises Suck
  207. then<U>(onFulfill: (...values: any[]) => U, onReject?: (...reasons: any[]) => U, onProgress?: (...progression: any[]) => any): JQueryPromise<U>;
  208. then<U>(onFulfill: (...values: any[]) => JQueryGenericPromise<U>, onReject?: (...reasons: any[]) => U, onProgress?: (...progression: any[]) => any): JQueryPromise<U>;
  209. then<U>(onFulfill: (...values: any[]) => U, onReject?: (...reasons: any[]) => JQueryGenericPromise<U>, onProgress?: (...progression: any[]) => any): JQueryPromise<U>;
  210. then<U>(onFulfill: (...values: any[]) => JQueryGenericPromise<U>, onReject?: (...reasons: any[]) => JQueryGenericPromise<U>, onProgress?: (...progression: any[]) => any): JQueryPromise<U>;
  211. }
  212. /*
  213. Interface for the JQuery deferred, part of callbacks
  214. */
  215. interface JQueryDeferred<T> extends JQueryPromise<T> {
  216. // Generic versions of callbacks
  217. always(...alwaysCallbacks: T[]): JQueryDeferred<T>;
  218. done(...doneCallbacks: T[]): JQueryDeferred<T>;
  219. fail(...failCallbacks: T[]): JQueryDeferred<T>;
  220. progress(...progressCallbacks: T[]): JQueryDeferred<T>;
  221. always(...alwaysCallbacks: any[]): JQueryDeferred<T>;
  222. done(...doneCallbacks: any[]): JQueryDeferred<T>;
  223. fail(...failCallbacks: any[]): JQueryDeferred<T>;
  224. progress(...progressCallbacks: any[]): JQueryDeferred<T>;
  225. notify(...args: any[]): JQueryDeferred<T>;
  226. notifyWith(context: any, ...args: any[]): JQueryDeferred<T>;
  227. reject(...args: any[]): JQueryDeferred<T>;
  228. rejectWith(context: any, ...args: any[]): JQueryDeferred<T>;
  229. resolve(val: T): JQueryDeferred<T>;
  230. resolve(...args: any[]): JQueryDeferred<T>;
  231. resolveWith(context: any, ...args: any[]): JQueryDeferred<T>;
  232. state(): string;
  233. promise(target?: any): JQueryPromise<T>;
  234. }
  235. /*
  236. Interface of the JQuery extension of the W3C event object
  237. */
  238. interface BaseJQueryEventObject extends Event {
  239. data: any;
  240. delegateTarget: Element;
  241. isDefaultPrevented(): boolean;
  242. isImmediatePropagationStopped(): boolean;
  243. isPropagationStopped(): boolean;
  244. namespace: string;
  245. preventDefault(): any;
  246. relatedTarget: Element;
  247. result: any;
  248. stopImmediatePropagation(): void;
  249. stopPropagation(): void;
  250. pageX: number;
  251. pageY: number;
  252. which: number;
  253. metaKey: boolean;
  254. }
  255. interface JQueryInputEventObject extends BaseJQueryEventObject {
  256. altKey: boolean;
  257. ctrlKey: boolean;
  258. metaKey: boolean;
  259. shiftKey: boolean;
  260. }
  261. interface JQueryMouseEventObject extends JQueryInputEventObject {
  262. button: number;
  263. clientX: number;
  264. clientY: number;
  265. offsetX: number;
  266. offsetY: number;
  267. pageX: number;
  268. pageY: number;
  269. screenX: number;
  270. screenY: number;
  271. }
  272. interface JQueryKeyEventObject extends JQueryInputEventObject {
  273. char: any;
  274. charCode: number;
  275. key: any;
  276. keyCode: number;
  277. }
  278. interface JQueryPopStateEventObject extends BaseJQueryEventObject {
  279. originalEvent: PopStateEvent;
  280. }
  281. interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject, JQueryPopStateEventObject {
  282. }
  283. /*
  284. Collection of properties of the current browser
  285. */
  286. interface JQuerySupport {
  287. ajax?: boolean;
  288. boxModel?: boolean;
  289. changeBubbles?: boolean;
  290. checkClone?: boolean;
  291. checkOn?: boolean;
  292. cors?: boolean;
  293. cssFloat?: boolean;
  294. hrefNormalized?: boolean;
  295. htmlSerialize?: boolean;
  296. leadingWhitespace?: boolean;
  297. noCloneChecked?: boolean;
  298. noCloneEvent?: boolean;
  299. opacity?: boolean;
  300. optDisabled?: boolean;
  301. optSelected?: boolean;
  302. scriptEval? (): boolean;
  303. style?: boolean;
  304. submitBubbles?: boolean;
  305. tbody?: boolean;
  306. }
  307. interface JQueryParam {
  308. (obj: any): string;
  309. (obj: any, traditional: boolean): string;
  310. }
  311. /**
  312. * The interface used to construct jQuery events (with $.Event). It is
  313. * defined separately instead of inline in JQueryStatic to allow
  314. * overriding the construction function with specific strings
  315. * returning specific event objects.
  316. */
  317. interface JQueryEventConstructor {
  318. (name: string, eventProperties?: any): JQueryEventObject;
  319. new (name: string, eventProperties?: any): JQueryEventObject;
  320. }
  321. /*
  322. Static members of jQuery (those on $ and jQuery themselves)
  323. */
  324. interface JQueryStatic {
  325. /**
  326. * Perform an asynchronous HTTP (Ajax) request.
  327. *
  328. * @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().
  329. */
  330. ajax(settings: JQueryAjaxSettings): JQueryXHR;
  331. /**
  332. * Perform an asynchronous HTTP (Ajax) request.
  333. *
  334. * @param url A string containing the URL to which the request is sent.
  335. * @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().
  336. */
  337. ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR;
  338. /**
  339. * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().
  340. *
  341. * @param dataTypes An optional string containing one or more space-separated dataTypes
  342. * @param handler A handler to set default values for future Ajax requests.
  343. */
  344. ajaxPrefilter(dataTypes: string, handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void;
  345. /**
  346. * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().
  347. *
  348. * @param handler A handler to set default values for future Ajax requests.
  349. */
  350. ajaxPrefilter(handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void;
  351. ajaxSettings: JQueryAjaxSettings;
  352. /**
  353. * Set default values for future Ajax requests. Its use is not recommended.
  354. *
  355. * @param options A set of key/value pairs that configure the default Ajax request. All options are optional.
  356. */
  357. ajaxSetup(options: JQueryAjaxSettings): void;
  358. /**
  359. * Load data from the server using a HTTP GET request.
  360. *
  361. * @param url A string containing the URL to which the request is sent.
  362. * @param success A callback function that is executed if the request succeeds.
  363. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).
  364. */
  365. get(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
  366. /**
  367. * Load data from the server using a HTTP GET request.
  368. *
  369. * @param url A string containing the URL to which the request is sent.
  370. * @param data A plain object or string that is sent to the server with the request.
  371. * @param success A callback function that is executed if the request succeeds.
  372. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).
  373. */
  374. get(url: string, data?: Object, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
  375. /**
  376. * Load data from the server using a HTTP GET request.
  377. *
  378. * @param url A string containing the URL to which the request is sent.
  379. * @param data A plain object or string that is sent to the server with the request.
  380. * @param success A callback function that is executed if the request succeeds.
  381. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).
  382. */
  383. get(url: string, data?: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
  384. /**
  385. * Load JSON-encoded data from the server using a GET HTTP request.
  386. *
  387. * @param url A string containing the URL to which the request is sent.
  388. * @param success A callback function that is executed if the request succeeds.
  389. */
  390. getJSON(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
  391. /**
  392. * Load JSON-encoded data from the server using a GET HTTP request.
  393. *
  394. * @param url A string containing the URL to which the request is sent.
  395. * @param data A plain object or string that is sent to the server with the request.
  396. * @param success A callback function that is executed if the request succeeds.
  397. */
  398. getJSON(url: string, data?: Object, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
  399. /**
  400. * Load JSON-encoded data from the server using a GET HTTP request.
  401. *
  402. * @param url A string containing the URL to which the request is sent.
  403. * @param data A plain object or string that is sent to the server with the request.
  404. * @param success A callback function that is executed if the request succeeds.
  405. */
  406. getJSON(url: string, data?: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
  407. /**
  408. * Load a JavaScript file from the server using a GET HTTP request, then execute it.
  409. *
  410. * @param url A string containing the URL to which the request is sent.
  411. * @param success A callback function that is executed if the request succeeds.
  412. */
  413. getScript(url: string, success?: (script: string, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
  414. param: JQueryParam;
  415. /**
  416. * Load data from the server using a HTTP POST request.
  417. *
  418. * @param url A string containing the URL to which the request is sent.
  419. * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case.
  420. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
  421. */
  422. post(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
  423. /**
  424. * Load data from the server using a HTTP POST request.
  425. *
  426. * @param url A string containing the URL to which the request is sent.
  427. * @param data A plain object or string that is sent to the server with the request.
  428. * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case.
  429. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
  430. */
  431. post(url: string, data?: Object, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
  432. /**
  433. * Load data from the server using a HTTP POST request.
  434. *
  435. * @param url A string containing the URL to which the request is sent.
  436. * @param data A plain object or string that is sent to the server with the request.
  437. * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case.
  438. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
  439. */
  440. post(url: string, data?: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
  441. /**
  442. * A multi-purpose callbacks list object that provides a powerful way to manage callback lists.
  443. *
  444. * @param flags An optional list of space-separated flags that change how the callback list behaves.
  445. */
  446. Callbacks(flags?: string): JQueryCallback;
  447. /**
  448. * Holds or releases the execution of jQuery's ready event.
  449. *
  450. * @param hold Indicates whether the ready hold is being requested or released
  451. */
  452. holdReady(hold: boolean): void;
  453. (selector: string, context?: any): JQuery;
  454. (element: Element): JQuery;
  455. (object: {}): JQuery;
  456. (elementArray: Element[]): JQuery;
  457. (object: JQuery): JQuery;
  458. (func: Function): JQuery;
  459. (array: any[]): JQuery;
  460. (): JQuery;
  461. /**
  462. * Relinquish jQuery's control of the $ variable.
  463. *
  464. * @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself).
  465. */
  466. noConflict(removeAll?: boolean): Object;
  467. /**
  468. * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
  469. *
  470. * @param deferreds One or more Deferred objects, or plain JavaScript objects.
  471. */
  472. when<T>(...deferreds: JQueryGenericPromise<T>[]): JQueryPromise<T>;
  473. /**
  474. * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
  475. *
  476. * @param deferreds One or more Deferred objects, or plain JavaScript objects.
  477. */
  478. when<T>(...deferreds: T[]): JQueryPromise<T>;
  479. /**
  480. * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
  481. *
  482. * @param deferreds One or more Deferred objects, or plain JavaScript objects.
  483. */
  484. when<T>(...deferreds: any[]): JQueryPromise<T>;
  485. cssHooks: { [key: string]: any; };
  486. cssNumber: any;
  487. /**
  488. * Store arbitrary data associated with the specified element. Returns the value that was set.
  489. *
  490. * @param element The DOM element to associate with the data.
  491. * @param key A string naming the piece of data to set.
  492. * @param value The new data value.
  493. */
  494. data<T>(element: Element, key: string, value: T): T;
  495. /**
  496. * 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.
  497. *
  498. * @param element The DOM element to associate with the data.
  499. * @param key A string naming the piece of data to set.
  500. */
  501. data(element: Element, key: string): any;
  502. /**
  503. * 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.
  504. *
  505. * @param element The DOM element to associate with the data.
  506. */
  507. data(element: Element): any;
  508. dequeue(element: Element, queueName?: string): any;
  509. hasData(element: Element): boolean;
  510. queue(element: Element, queueName?: string): any[];
  511. queue(element: Element, queueName: string, newQueueOrCallback: any): JQuery;
  512. removeData(element: Element, name?: string): JQuery;
  513. // Deferred
  514. Deferred<T>(beforeStart?: (deferred: JQueryDeferred<T>) => any): JQueryDeferred<T>;
  515. // Effects
  516. fx: { tick: () => void; interval: number; stop: () => void; speeds: { slow: number; fast: number; }; off: boolean; step: any; };
  517. // Events
  518. proxy(fn: (...args: any[]) => any, context: any, ...args: any[]): any;
  519. proxy(context: any, name: string, ...args: any[]): any;
  520. Event: JQueryEventConstructor;
  521. // Internals
  522. error(message: any): JQuery;
  523. // Miscellaneous
  524. expr: any;
  525. fn: any; //TODO: Decide how we want to type this
  526. isReady: boolean;
  527. // Properties
  528. support: JQuerySupport;
  529. // Utilities
  530. contains(container: Element, contained: Element): boolean;
  531. each(collection: any, callback: (indexInArray: any, valueOfElement: any) => any): any;
  532. each(collection: JQuery, callback: (indexInArray: number, valueOfElement: HTMLElement) => any): any;
  533. each<T>(collection: T[], callback: (indexInArray: number, valueOfElement: T) => any): any;
  534. extend(target: any, ...objs: any[]): any;
  535. extend(deep: boolean, target: any, ...objs: any[]): any;
  536. globalEval(code: string): any;
  537. grep<T>(array: T[], func: (elementOfArray: T, indexInArray: number) => boolean, invert?: boolean): T[];
  538. inArray<T>(value: T, array: T[], fromIndex?: number): number;
  539. isArray(obj: any): boolean;
  540. isEmptyObject(obj: any): boolean;
  541. isFunction(obj: any): boolean;
  542. isNumeric(value: any): boolean;
  543. isPlainObject(obj: any): boolean;
  544. isWindow(obj: any): boolean;
  545. isXMLDoc(node: Node): boolean;
  546. makeArray(obj: any): any[];
  547. map<T, U>(array: T[], callback: (elementOfArray: T, indexInArray: number) => U): U[];
  548. map(array: any, callback: (elementOfArray: any, indexInArray: any) => any): any;
  549. merge<T>(first: T[], second: T[]): T[];
  550. merge<T, U>(first: T[], second: U[]): any[];
  551. noop(): any;
  552. now(): number;
  553. parseJSON(json: string): any;
  554. /**
  555. * Parses a string into an XML document.
  556. *
  557. * @param dataa well-formed XML string to be parsed
  558. */
  559. parseXML(data: string): XMLDocument;
  560. queue(element: Element, queueName: string, newQueue: any[]): JQuery;
  561. trim(str: string): string;
  562. type(obj: any): string;
  563. unique(arr: any[]): any[];
  564. /**
  565. * Parses a string into an array of DOM nodes.
  566. *
  567. * @param data HTML string to be parsed
  568. * @param context DOM element to serve as the context in which the HTML fragment will be created
  569. * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string
  570. */
  571. parseHTML(data: string, context?: HTMLElement, keepScripts?: boolean): any[];
  572. Animation(elem: any, properties: any, options: any): any;
  573. }
  574. /*
  575. The jQuery instance members
  576. */
  577. interface JQuery {
  578. // AJAX
  579. ajaxComplete(handler: any): JQuery;
  580. ajaxError(handler: (event: any, jqXHR: any, settings: any, exception: any) => any): JQuery;
  581. ajaxSend(handler: (event: any, jqXHR: any, settings: any, exception: any) => any): JQuery;
  582. ajaxStart(handler: () => any): JQuery;
  583. ajaxStop(handler: () => any): JQuery;
  584. ajaxSuccess(handler: (event: any, jqXHR: any, settings: any, exception: any) => any): JQuery;
  585. load(url: string, data?: any, complete?: any): JQuery;
  586. serialize(): string;
  587. serializeArray(): any[];
  588. // Attributes
  589. addClass(classNames: string): JQuery;
  590. addClass(func: (index: any, currentClass: any) => string): JQuery;
  591. // http://api.jquery.com/addBack/
  592. addBack(selector?: string): JQuery;
  593. attr(attributeName: string): string;
  594. attr(attributeName: string, value: any): JQuery;
  595. attr(attributeName: string, func: (index: any, attr: any) => any): JQuery;
  596. attr(map: any): JQuery;
  597. hasClass(className: string): boolean;
  598. html(): string;
  599. html(htmlString: string): JQuery;
  600. html(htmlContent: (index: number, oldhtml: string) => string): JQuery;
  601. html(obj: JQuery): JQuery;
  602. prop(propertyName: string): any;
  603. prop(propertyName: string, value: any): JQuery;
  604. prop(map: any): JQuery;
  605. prop(propertyName: string, func: (index: any, oldPropertyValue: any) => any): JQuery;
  606. removeAttr(attributeName: string): JQuery;
  607. removeClass(className?: string): JQuery;
  608. removeClass(func: (index: any, cls: any) => any): JQuery;
  609. removeProp(propertyName: string): JQuery;
  610. toggleClass(className: string, swtch?: boolean): JQuery;
  611. toggleClass(swtch?: boolean): JQuery;
  612. toggleClass(func: (index: any, cls: any, swtch: any) => any): JQuery;
  613. val(): any;
  614. val(value: string[]): JQuery;
  615. val(value: string): JQuery;
  616. val(value: number): JQuery;
  617. val(func: (index: any, value: any) => any): JQuery;
  618. /**
  619. * Get the value of style properties for the first element in the set of matched elements.
  620. *
  621. * @param propertyName A CSS property.
  622. */
  623. css(propertyName: string): string;
  624. /**
  625. * Set one or more CSS properties for the set of matched elements.
  626. *
  627. * @param propertyName A CSS property name.
  628. * @param value A value to set for the property.
  629. */
  630. css(propertyName: string, value: string): JQuery;
  631. /**
  632. * Set one or more CSS properties for the set of matched elements.
  633. *
  634. * @param propertyName A CSS property name.
  635. * @param value A value to set for the property.
  636. */
  637. css(propertyName: string, value: number): JQuery;
  638. /**
  639. * Set one or more CSS properties for the set of matched elements.
  640. *
  641. * @param propertyName A CSS property name.
  642. * @param value A value to set for the property.
  643. */
  644. css(propertyName: string, value: string[]): JQuery;
  645. /**
  646. * Set one or more CSS properties for the set of matched elements.
  647. *
  648. * @param propertyName A CSS property name.
  649. * @param value A value to set for the property.
  650. */
  651. css(propertyName: string, value: number[]): JQuery;
  652. /**
  653. * Set one or more CSS properties for the set of matched elements.
  654. *
  655. * @param propertyName A CSS property name.
  656. * @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.
  657. */
  658. css(propertyName: string, value: (index: number, value: string) => string): JQuery;
  659. /**
  660. * Set one or more CSS properties for the set of matched elements.
  661. *
  662. * @param propertyName A CSS property name.
  663. * @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.
  664. */
  665. css(propertyName: string, value: (index: number, value: number) => number): JQuery;
  666. /**
  667. * Set one or more CSS properties for the set of matched elements.
  668. *
  669. * @param properties An object of property-value pairs to set.
  670. */
  671. css(properties: Object): JQuery;
  672. height(): number;
  673. height(value: number): JQuery;
  674. height(value: string): JQuery;
  675. height(func: (index: any, height: any) => any): JQuery;
  676. innerHeight(): number;
  677. innerHeight(value: number): JQuery;
  678. innerWidth(): number;
  679. innerWidth(value: number): JQuery;
  680. offset(): { left: number; top: number; };
  681. offset(coordinates: any): JQuery;
  682. offset(func: (index: any, coords: any) => any): JQuery;
  683. outerHeight(includeMargin?: boolean): number;
  684. outerHeight(value: number, includeMargin?: boolean): JQuery;
  685. outerWidth(includeMargin?: boolean): number;
  686. outerWidth(value: number, includeMargin?: boolean): JQuery;
  687. position(): { top: number; left: number; };
  688. scrollLeft(): number;
  689. scrollLeft(value: number): JQuery;
  690. scrollTop(): number;
  691. scrollTop(value: number): JQuery;
  692. width(): number;
  693. width(value: number): JQuery;
  694. width(value: string): JQuery;
  695. width(func: (index: any, height: any) => any): JQuery;
  696. // Data
  697. clearQueue(queueName?: string): JQuery;
  698. data(key: string, value: any): JQuery;
  699. data(obj: { [key: string]: any; }): JQuery;
  700. data(key?: string): any;
  701. dequeue(queueName?: string): JQuery;
  702. removeData(nameOrList?: any): JQuery;
  703. // Deferred
  704. promise(type?: any, target?: any): JQueryPromise<any>;
  705. // Effects
  706. animate(properties: any, duration?: any, complete?: Function): JQuery;
  707. animate(properties: any, duration?: any, easing?: string, complete?: Function): JQuery;
  708. animate(properties: any, options: { duration?: any; easing?: string; complete?: Function; step?: Function; queue?: boolean; specialEasing?: any; }): JQuery;
  709. delay(duration: number, queueName?: string): JQuery;
  710. fadeIn(duration?: any, callback?: any): JQuery;
  711. fadeIn(duration?: any, easing?: string, callback?: any): JQuery;
  712. fadeOut(duration?: any, callback?: any): JQuery;
  713. fadeOut(duration?: any, easing?: string, callback?: any): JQuery;
  714. fadeTo(duration: any, opacity: number, callback?: any): JQuery;
  715. fadeTo(duration: any, opacity: number, easing?: string, callback?: any): JQuery;
  716. fadeToggle(duration?: any, callback?: any): JQuery;
  717. fadeToggle(duration?: any, easing?: string, callback?: any): JQuery;
  718. finish(): JQuery;
  719. hide(duration?: any, callback?: any): JQuery;
  720. hide(duration?: any, easing?: string, callback?: any): JQuery;
  721. show(duration?: any, callback?: any): JQuery;
  722. show(duration?: any, easing?: string, callback?: any): JQuery;
  723. slideDown(duration?: any, callback?: any): JQuery;
  724. slideDown(duration?: any, easing?: string, callback?: any): JQuery;
  725. slideToggle(duration?: any, callback?: any): JQuery;
  726. slideToggle(duration?: any, easing?: string, callback?: any): JQuery;
  727. slideUp(duration?: any, callback?: any): JQuery;
  728. slideUp(duration?: any, easing?: string, callback?: any): JQuery;
  729. stop(clearQueue?: boolean, jumpToEnd?: boolean): JQuery;
  730. stop(queue?: any, clearQueue?: boolean, jumpToEnd?: boolean): JQuery;
  731. toggle(duration?: any, callback?: any): JQuery;
  732. toggle(duration?: any, easing?: string, callback?: any): JQuery;
  733. toggle(showOrHide: boolean): JQuery;
  734. // Events
  735. bind(eventType: string, eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
  736. bind(eventType: string, eventData: any, preventBubble: boolean): JQuery;
  737. bind(eventType: string, preventBubble: boolean): JQuery;
  738. bind(...events: any[]): JQuery;
  739. blur(handler: (eventObject: JQueryEventObject) => any): JQuery;
  740. blur(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
  741. /**
  742. * Trigger the "change" event on an element.
  743. */
  744. change(): JQuery;
  745. /**
  746. * Bind an event handler to the "change" JavaScript event
  747. *
  748. * @param handler A function to execute each time the event is triggered.
  749. */
  750. change(handler: (eventObject: JQueryEventObject) => any): JQuery;
  751. /**
  752. * Bind an event handler to the "change" JavaScript event
  753. *
  754. * @param eventData An object containing data that will be passed to the event handler.
  755. * @param handler A function to execute each time the event is triggered.
  756. */
  757. change(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
  758. /**
  759. * Trigger the "click" event on an element.
  760. */
  761. click(): JQuery;
  762. /**
  763. * Bind an event handler to the "click" JavaScript event
  764. *
  765. * @param eventData An object containing data that will be passed to the event handler.
  766. */
  767. click(handler: (eventObject: JQueryEventObject) => any): JQuery;
  768. /**
  769. * Bind an event handler to the "click" JavaScript event
  770. *
  771. * @param eventData An object containing data that will be passed to the event handler.
  772. * @param handler A function to execute each time the event is triggered.
  773. */
  774. click(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
  775. /**
  776. * Trigger the "dblclick" event on an element.
  777. */
  778. dblclick(): JQuery;
  779. /**
  780. * Bind an event handler to the "dblclick" JavaScript event
  781. *
  782. * @param handler A function to execute each time the event is triggered.
  783. */
  784. dblclick(handler: (eventObject: JQueryEventObject) => any): JQuery;
  785. /**
  786. * Bind an event handler to the "dblclick" JavaScript event
  787. *
  788. * @param eventData An object containing data that will be passed to the event handler.
  789. * @param handler A function to execute each time the event is triggered.
  790. */
  791. dblclick(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
  792. delegate(selector: any, eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
  793. /**
  794. * Trigger the "focus" event on an element.
  795. */
  796. focus(): JQuery;
  797. /**
  798. * Bind an event handler to the "focus" JavaScript event
  799. *
  800. * @param handler A function to execute each time the event is triggered.
  801. */
  802. focus(handler: (eventObject: JQueryEventObject) => any): JQuery;
  803. /**
  804. * Bind an event handler to the "focus" JavaScript event
  805. *
  806. * @param eventData An object containing data that will be passed to the event handler.
  807. * @param handler A function to execute each time the event is triggered.
  808. */
  809. focus(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
  810. /**
  811. * Bind an event handler to the "focusin" JavaScript event
  812. *
  813. * @param handler A function to execute each time the event is triggered.
  814. */
  815. focusin(handler: (eventObject: JQueryEventObject) => any): JQuery;
  816. /**
  817. * Bind an event handler to the "focusin" JavaScript event
  818. *
  819. * @param eventData An object containing data that will be passed to the event handler.
  820. * @param handler A function to execute each time the event is triggered.
  821. */
  822. focusin(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
  823. /**
  824. * Bind an event handler to the "focusout" JavaScript event
  825. *
  826. * @param handler A function to execute each time the event is triggered.
  827. */
  828. focusout(handler: (eventObject: JQueryEventObject) => any): JQuery;
  829. /**
  830. * Bind an event handler to the "focusout" JavaScript event
  831. *
  832. * @param eventData An object containing data that will be passed to the event handler.
  833. * @param handler A function to execute each time the event is triggered.
  834. */
  835. focusout(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
  836. /**
  837. * Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.
  838. *
  839. * @param handlerIn A function to execute when the mouse pointer enters the element.
  840. * @param handlerOut A function to execute when the mouse pointer leaves the element.
  841. */
  842. hover(handlerIn: (eventObject: JQueryEventObject) => any, handlerOut: (eventObject: JQueryEventObject) => any): JQuery;
  843. /**
  844. * Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements.
  845. *
  846. * @param handlerInOut A function to execute when the mouse pointer enters or leaves the element.
  847. */
  848. hover(handlerInOut: (eventObject: JQueryEventObject) => any): JQuery;
  849. /**
  850. * Trigger the "keydown" event on an element.
  851. */
  852. keydown(): JQuery;
  853. /**
  854. * Bind an event handler to the "keydown" JavaScript event
  855. *
  856. * @param handler A function to execute each time the event is triggered.
  857. */
  858. keydown(handler: (eventObject: JQueryKeyEventObject) => any): JQuery;
  859. /**
  860. * Bind an event handler to the keydown"" JavaScript event
  861. *
  862. * @param eventData An object containing data that will be passed to the event handler.
  863. * @param handler A function to execute each time the event is triggered.
  864. */
  865. keydown(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery;
  866. /**
  867. * Trigger the "keypress" event on an element.
  868. */
  869. keypress(): JQuery;
  870. /**
  871. * Bind an event handler to the "keypress" JavaScript event
  872. *
  873. * @param handler A function to execute each time the event is triggered.
  874. */
  875. keypress(handler: (eventObject: JQueryKeyEventObject) => any): JQuery;
  876. /**
  877. * Bind an event handler to the "keypress" JavaScript event
  878. *
  879. * @param eventData An object containing data that will be passed to the event handler.
  880. * @param handler A function to execute each time the event is triggered.
  881. */
  882. keypress(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery;
  883. /**
  884. * Trigger the "keyup" event on an element.
  885. */
  886. keyup(): JQuery;
  887. /**
  888. * Bind an event handler to the "keyup" JavaScript event
  889. *
  890. * @param handler A function to execute each time the event is triggered.
  891. */
  892. keyup(handler: (eventObject: JQueryKeyEventObject) => any): JQuery;
  893. /**
  894. * Bind an event handler to the "keyup" JavaScript event
  895. *
  896. * @param eventData An object containing data that will be passed to the event handler.
  897. * @param handler A function to execute each time the event is triggered.
  898. */
  899. keyup(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery;
  900. /**
  901. * Bind an event handler to the "load" JavaScript event.
  902. *
  903. * @param handler A function to execute when the event is triggered.
  904. */
  905. load(handler: (eventObject: JQueryEventObject) => any): JQuery;
  906. /**
  907. * Bind an event handler to the "load" JavaScript event.
  908. *
  909. * @param eventData An object containing data that will be passed to the event handler.
  910. * @param handler A function to execute when the event is triggered.
  911. */
  912. load(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
  913. /**
  914. * Trigger the "mousedown" event on an element.
  915. */
  916. mousedown(): JQuery;
  917. /**
  918. * Bind an event handler to the "mousedown" JavaScript event.
  919. *
  920. * @param handler A function to execute when the event is triggered.
  921. */
  922. mousedown(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
  923. /**
  924. * Bind an event handler to the "mousedown" JavaScript event.
  925. *
  926. * @param eventData An object containing data that will be passed to the event handler.
  927. * @param handler A function to execute when the event is triggered.
  928. */
  929. mousedown(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
  930. /**
  931. * Trigger the "mouseenter" event on an element.
  932. */
  933. mouseenter(): JQuery;
  934. /**
  935. * Bind an event handler to be fired when the mouse enters an element.
  936. *
  937. * @param handler A function to execute when the event is triggered.
  938. */
  939. mouseenter(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
  940. /**
  941. * Bind an event handler to be fired when the mouse enters an element.
  942. *
  943. * @param eventData An object containing data that will be passed to the event handler.
  944. * @param handler A function to execute when the event is triggered.
  945. */
  946. mouseenter(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
  947. /**
  948. * Trigger the "mouseleave" event on an element.
  949. */
  950. mouseleave(): JQuery;
  951. /**
  952. * Bind an event handler to be fired when the mouse leaves an element.
  953. *
  954. * @param handler A function to execute when the event is triggered.
  955. */
  956. mouseleave(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
  957. /**
  958. * Bind an event handler to be fired when the mouse leaves an element.
  959. *
  960. * @param eventData An object containing data that will be passed to the event handler.
  961. * @param handler A function to execute when the event is triggered.
  962. */
  963. mouseleave(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
  964. /**
  965. * Trigger the "mousemove" event on an element.
  966. */
  967. mousemove(): JQuery;
  968. /**
  969. * Bind an event handler to the "mousemove" JavaScript event.
  970. *
  971. * @param handler A function to execute when the event is triggered.
  972. */
  973. mousemove(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
  974. /**
  975. * Bind an event handler to the "mousemove" JavaScript event.
  976. *
  977. * @param eventData An object containing data that will be passed to the event handler.
  978. * @param handler A function to execute when the event is triggered.
  979. */
  980. mousemove(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
  981. /**
  982. * Trigger the "mouseout" event on an element.
  983. */
  984. mouseout(): JQuery;
  985. /**
  986. * Bind an event handler to the "mouseout" JavaScript event.
  987. *
  988. * @param handler A function to execute when the event is triggered.
  989. */
  990. mouseout(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
  991. /**
  992. * Bind an event handler to the "mouseout" JavaScript event.
  993. *
  994. * @param eventData An object containing data that will be passed to the event handler.
  995. * @param handler A function to execute when the event is triggered.
  996. */
  997. mouseout(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
  998. /**
  999. * Trigger the "mouseover" event on an element.
  1000. */
  1001. mouseover(): JQuery;
  1002. /**
  1003. * Bind an event handler to the "mouseover" JavaScript event.
  1004. *
  1005. * @param handler A function to execute when the event is triggered.
  1006. */
  1007. mouseover(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
  1008. /**
  1009. * Bind an event handler to the "mouseover" JavaScript event.
  1010. *
  1011. * @param eventData An object containing data that will be passed to the event handler.
  1012. * @param handler A function to execute when the event is triggered.
  1013. */
  1014. mouseover(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
  1015. /**
  1016. * Trigger the "mouseup" event on an element.
  1017. */
  1018. mouseup(): JQuery;
  1019. /**
  1020. * Bind an event handler to the "mouseup" JavaScript event.
  1021. *
  1022. * @param handler A function to execute when the event is triggered.
  1023. */
  1024. mouseup(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
  1025. /**
  1026. * Bind an event handler to the "mouseup" JavaScript event.
  1027. *
  1028. * @param eventData An object containing data that will be passed to the event handler.
  1029. * @param handler A function to execute when the event is triggered.
  1030. */
  1031. mouseup(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
  1032. /**
  1033. * Remove an event handler.
  1034. */
  1035. off(): JQuery;
  1036. /**
  1037. * Remove an event handler.
  1038. *
  1039. * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".
  1040. * @param selector A selector which should match the one originally passed to .on() when attaching event handlers.
  1041. * @param handler A handler function previously attached for the event(s), or the special value false.
  1042. */
  1043. off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
  1044. /**
  1045. * Remove an event handler.
  1046. *
  1047. * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".
  1048. * @param handler A handler function previously attached for the event(s), or the special value false.
  1049. */
  1050. off(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
  1051. /**
  1052. * Remove an event handler.
  1053. *
  1054. * @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).
  1055. * @param selector A selector which should match the one originally passed to .on() when attaching event handlers.
  1056. */
  1057. off(events: { [key: string]: any; }, selector?: string): JQuery;
  1058. /**
  1059. * Attach an event handler function for one or more events to the selected elements.
  1060. *
  1061. * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
  1062. * @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.
  1063. */
  1064. on(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
  1065. /**
  1066. * Attach an event handler function for one or more events to the selected elements.
  1067. *
  1068. * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
  1069. * @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.
  1070. * @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.
  1071. */
  1072. on(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
  1073. /**
  1074. * Attach an event handler function for one or more events to the selected elements.
  1075. *
  1076. * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
  1077. * @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.
  1078. * @param data Data to be passed to the handler in event.data when an event is triggered.
  1079. * @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.
  1080. */
  1081. on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
  1082. /**
  1083. * Attach an event handler function for one or more events to the selected elements.
  1084. *
  1085. * @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).
  1086. * @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.
  1087. * @param data Data to be passed to the handler in event.data when an event occurs.
  1088. */
  1089. on(events: { [key: string]: any; }, selector?: any, data?: any): JQuery;
  1090. /**
  1091. * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
  1092. *
  1093. * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
  1094. * @param handler A function to execute at the time the event is triggered.
  1095. */
  1096. one(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
  1097. /**
  1098. * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
  1099. *
  1100. * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
  1101. * @param data An object containing data that will be passed to the event handler.
  1102. * @param handler A function to execute at the time the event is triggered.
  1103. */
  1104. one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
  1105. /**
  1106. * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
  1107. *
  1108. * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
  1109. * @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.
  1110. * @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.
  1111. */
  1112. one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
  1113. /**
  1114. * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
  1115. *
  1116. * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
  1117. * @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.
  1118. * @param data Data to be passed to the handler in event.data when an event is triggered.
  1119. * @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.
  1120. */
  1121. one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
  1122. /**
  1123. * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
  1124. *
  1125. * @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).
  1126. * @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.
  1127. * @param data Data to be passed to the handler in event.data when an event occurs.
  1128. */
  1129. one(events: { [key: string]: any; }, selector?: string, data?: any): JQuery;
  1130. /**
  1131. * Specify a function to execute when the DOM is fully loaded.
  1132. *
  1133. * @param handler A function to execute after the DOM is ready.
  1134. */
  1135. ready(handler: Function): JQuery;
  1136. /**
  1137. * Trigger the "resize" event on an element.
  1138. */
  1139. resize(): JQuery;
  1140. /**
  1141. * Bind an event handler to the "resize" JavaScript event.
  1142. *
  1143. * @param handler A function to execute each time the event is triggered.
  1144. */
  1145. resize(handler: (eventObject: JQueryEventObject) => any): JQuery;
  1146. /**
  1147. * Bind an event handler to the "resize" JavaScript event.
  1148. *
  1149. * @param eventData An object containing data that will be passed to the event handler.
  1150. * @param handler A function to execute each time the event is triggered.
  1151. */
  1152. resize(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
  1153. /**
  1154. * Trigger the "scroll" event on an element.
  1155. */
  1156. scroll(): JQuery;
  1157. /**
  1158. * Bind an event handler to the "scroll" JavaScript event.
  1159. *
  1160. * @param handler A function to execute each time the event is triggered.
  1161. */
  1162. scroll(handler: (eventObject: JQueryEventObject) => any): JQuery;
  1163. /**
  1164. * Bind an event handler to the "scroll" JavaScript event.
  1165. *
  1166. * @param eventData An object containing data that will be passed to the event handler.
  1167. * @param handler A function to execute each time the event is triggered.
  1168. */
  1169. scroll(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
  1170. /**
  1171. * Trigger the "select" event on an element.
  1172. */
  1173. select(): JQuery;
  1174. /**
  1175. * Bind an event handler to the "select" JavaScript event.
  1176. *
  1177. * @param handler A function to execute each time the event is triggered.
  1178. */
  1179. select(handler: (eventObject: JQueryEventObject) => any): JQuery;
  1180. /**
  1181. * Bind an event handler to the "select" JavaScript event.
  1182. *
  1183. * @param eventData An object containing data that will be passed to the event handler.
  1184. * @param handler A function to execute each time the event is triggered.
  1185. */
  1186. select(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
  1187. /**
  1188. * Trigger the "submit" event on an element.
  1189. */
  1190. submit(): JQuery;
  1191. /**
  1192. * Bind an event handler to the "submit" JavaScript event
  1193. *
  1194. * @param handler A function to execute each time the event is triggered.
  1195. */
  1196. submit(handler: (eventObject: JQueryEventObject) => any): JQuery;
  1197. /**
  1198. * Bind an event handler to the "submit" JavaScript event
  1199. *
  1200. * @param eventData An object containing data that will be passed to the event handler.
  1201. * @param handler A function to execute each time the event is triggered.
  1202. */
  1203. submit(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
  1204. trigger(eventType: string, ...extraParameters: any[]): JQuery;
  1205. trigger(event: JQueryEventObject): JQuery;
  1206. triggerHandler(eventType: string, ...extraParameters: any[]): Object;
  1207. unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
  1208. unbind(eventType: string, fls: boolean): JQuery;
  1209. unbind(evt: any): JQuery;
  1210. undelegate(): JQuery;
  1211. undelegate(selector: any, eventType: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
  1212. undelegate(selector: any, events: any): JQuery;
  1213. undelegate(namespace: string): JQuery;
  1214. unload(handler: (eventObject: JQueryEventObject) => any): JQuery;
  1215. unload(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
  1216. // Internals
  1217. context: Element;
  1218. jquery: string;
  1219. error(handler: (eventObject: JQueryEventObject) => any): JQuery;
  1220. error(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
  1221. pushStack(elements: any[]): JQuery;
  1222. pushStack(elements: any[], name: any, arguments: any): JQuery;
  1223. // Manipulation
  1224. after(...content: any[]): JQuery;
  1225. after(func: (index: any) => any): JQuery;
  1226. append(...content: any[]): JQuery;
  1227. append(func: (index: any, html: any) => any): JQuery;
  1228. appendTo(target: any): JQuery;
  1229. before(...content: any[]): JQuery;
  1230. before(func: (index: any) => any): JQuery;
  1231. clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): JQuery;
  1232. detach(selector?: any): JQuery;
  1233. empty(): JQuery;
  1234. insertAfter(target: any): JQuery;
  1235. insertBefore(target: any): JQuery;
  1236. prepend(...content: any[]): JQuery;
  1237. prepend(func: (index: any, html: any) => any): JQuery;
  1238. prependTo(target: any): JQuery;
  1239. remove(selector?: any): JQuery;
  1240. replaceAll(target: any): JQuery;
  1241. replaceWith(func: any): JQuery;
  1242. text(): string;
  1243. text(textString: any): JQuery;
  1244. text(textString: (index: number, text: string) => string): JQuery;
  1245. toArray(): any[];
  1246. unwrap(): JQuery;
  1247. wrap(wrappingElement: any): JQuery;
  1248. wrap(func: (index: any) => any): JQuery;
  1249. wrapAll(wrappingElement: any): JQuery;
  1250. wrapInner(wrappingElement: any): JQuery;
  1251. wrapInner(func: (index: any) => any): JQuery;
  1252. // Miscellaneous
  1253. each(func: (index: any, elem: Element) => any): JQuery;
  1254. get(index?: number): any;
  1255. index(): number;
  1256. index(selector: string): number;
  1257. index(element: any): number;
  1258. // Properties
  1259. length: number;
  1260. selector: string;
  1261. [x: string]: any;
  1262. [x: number]: HTMLElement;
  1263. // Traversing
  1264. add(selector: string, context?: any): JQuery;
  1265. add(...elements: any[]): JQuery;
  1266. add(html: string): JQuery;
  1267. add(obj: JQuery): JQuery;
  1268. children(selector?: any): JQuery;
  1269. closest(selector: string): JQuery;
  1270. closest(selector: string, context?: Element): JQuery;
  1271. closest(obj: JQuery): JQuery;
  1272. closest(element: any): JQuery;
  1273. closest(selectors: any, context?: Element): any[];
  1274. contents(): JQuery;
  1275. end(): JQuery;
  1276. eq(index: number): JQuery;
  1277. filter(selector: string): JQuery;
  1278. filter(func: (index: any) => any): JQuery;
  1279. filter(element: any): JQuery;
  1280. filter(obj: JQuery): JQuery;
  1281. find(selector: string): JQuery;
  1282. find(element: any): JQuery;
  1283. find(obj: JQuery): JQuery;
  1284. first(): JQuery;
  1285. has(selector: string): JQuery;
  1286. has(contained: Element): JQuery;
  1287. is(selector: string): boolean;
  1288. is(func: (index: any) => any): boolean;
  1289. is(element: any): boolean;
  1290. is(obj: JQuery): boolean;
  1291. last(): JQuery;
  1292. map(callback: (index: any, domElement: Element) => any): JQuery;
  1293. next(selector?: string): JQuery;
  1294. nextAll(selector?: string): JQuery;
  1295. nextUntil(selector?: string, filter?: string): JQuery;
  1296. nextUntil(element?: Element, filter?: string): JQuery;
  1297. nextUntil(obj?: JQuery, filter?: string): JQuery;
  1298. not(selector: string): JQuery;
  1299. not(func: (index: any) => any): JQuery;
  1300. not(element: any): JQuery;
  1301. not(obj: JQuery): JQuery;
  1302. offsetParent(): JQuery;
  1303. parent(selector?: string): JQuery;
  1304. parents(selector?: string): JQuery;
  1305. parentsUntil(selector?: string, filter?: string): JQuery;
  1306. parentsUntil(element?: Element, filter?: string): JQuery;
  1307. parentsUntil(obj?: JQuery, filter?: string): JQuery;
  1308. prev(selector?: string): JQuery;
  1309. prevAll(selector?: string): JQuery;
  1310. prevUntil(selector?: string, filter?: string): JQuery;
  1311. prevUntil(element?: Element, filter?: string): JQuery;
  1312. prevUntil(obj?: JQuery, filter?: string): JQuery;
  1313. siblings(selector?: string): JQuery;
  1314. slice(start: number, end?: number): JQuery;
  1315. // Utilities
  1316. queue(queueName?: string): any[];
  1317. queue(queueName: string, newQueueOrCallback: any): JQuery;
  1318. queue(newQueueOrCallback: any): JQuery;
  1319. }
  1320. declare module "jquery" {
  1321. export = $;
  1322. }
  1323. declare var jQuery: JQueryStatic;
  1324. declare var $: JQueryStatic;