UNPKG

cypress

Version:

Cypress is a next generation front end testing tool built for the modern web

1,505 lines (1,504 loc) 453 kB
// tslint:disable:jsdoc-format // tslint:disable:max-line-length // tslint:disable:no-irregular-whitespace interface JQueryStatic { /** * @see \`{@link https://api.jquery.com/jquery.ajax/#jQuery-ajax1 }\` * @deprecated ​ Deprecated. Use \`{@link ajaxSetup }\`. */ ajaxSettings: JQuery.AjaxSettings; Animation: JQuery.AnimationStatic; Callbacks: JQuery.CallbacksStatic; /** * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties. * @see \`{@link https://api.jquery.com/jQuery.cssHooks/ }\` * @since 1.4.3 */ cssHooks: JQuery.CSSHooks; /** * An object containing all CSS properties that may be used without a unit. The .css() method uses this object to see if it may append px to unitless values. * @see \`{@link https://api.jquery.com/jQuery.cssNumber/ }\` * @since 1.4.3 */ cssNumber: JQuery.PlainObject<boolean>; Deferred: JQuery.DeferredStatic; easing: JQuery.Easings; Event: JQuery.EventStatic; /** * @see \`{@link https://learn.jquery.com/events/event-extensions/ }\` */ event: JQuery.EventExtensions; expr: JQuery.Selectors; // Set to HTMLElement to minimize breaks but should probably be Element. readonly fn: JQuery; fx: JQuery.Effects; /** * A Promise-like object (or "thenable") that resolves when the document is ready. * @see \`{@link https://api.jquery.com/jQuery.ready/ }\` * @since 1.8 * @example ​ ````Listen for document ready using jQuery.when. ```javascript $.when( $.ready ).then(function() { // Document is ready. }); ``` * @example ​ ````Typical usage involving another promise, using jQuery.when. ```javascript $.when( $.getJSON( "ajax/test.json" ), $.ready ).done(function( data ) { // Document is ready. // Value of test.json is passed as `data`. }); ``` */ ready: JQuery.Thenable<JQueryStatic>; /** * A collection of properties that represent the presence of different browser features or bugs. Intended for jQuery's internal use; specific properties may be removed when they are no longer needed internally to improve page startup performance. For your own project's feature-detection needs, we strongly recommend the use of an external library such as Modernizr instead of dependency on properties in jQuery.support. * @see \`{@link https://api.jquery.com/jQuery.support/ }\` * @since 1.3 * @deprecated ​ Deprecated since 1.9. See \`{@link https://api.jquery.com/jQuery.support/ }\`. */ support: JQuery.PlainObject; timers: Array<JQuery.TickFunction<any>>; Tween: JQuery.TweenStatic; valHooks: JQuery.ValHooks; // HACK: This is the factory function returned when importing jQuery without a DOM. Declaring it separately breaks using the type parameter on JQueryStatic. // HACK: The discriminator parameter handles the edge case of passing a Window object to JQueryStatic. It doesn't actually exist on the factory function. (window: Window, discriminator: boolean): JQueryStatic; /** * Creates DOM elements on the fly from the provided string of raw HTML. * @param html _&#x40;param_ `html` * <br> * * `html (ownerDocument)` — A string of HTML to create on the fly. Note that this parses HTML, not XML. <br> * * `html (attributes)` — A string defining a single, standalone, HTML element (e.g. &lt;div/&gt; or &lt;div&gt;&lt;/div&gt;). * @param ownerDocument_attributes _&#x40;param_ `ownerDocument_attributes` * <br> * * `ownerDocument` — A document in which the new elements will be created. <br> * * `attributes` — An object of attributes, events, and methods to call on the newly-created element. * @see \`{@link https://api.jquery.com/jQuery/ }\` * @since 1.0 * @since 1.4 * @example ​ ````Create a div element (and all of its contents) dynamically and append it to the body element. Internally, an element is created and its innerHTML property set to the given markup. ```javascript $( "<div><p>Hello</p></div>" ).appendTo( "body" ) ``` * @example ​ ````Create some DOM elements. ```javascript $( "<div/>", { "class": "test", text: "Click me!", click: function() { $( this ).toggleClass( "test" ); } }) .appendTo( "body" ); ``` */ // tslint:disable-next-line:no-unnecessary-generics <TElement extends HTMLElement = HTMLElement>(html: JQuery.htmlString, ownerDocument_attributes?: Document | JQuery.PlainObject): JQuery<TElement>; /** * Accepts a string containing a CSS selector which is then used to match a set of elements. * @param selector A string containing a selector expression * @param context A DOM Element, Document, or jQuery to use as context * @see \`{@link https://api.jquery.com/jQuery/ }\` * @since 1.0 * @example ​ ````Find all p elements that are children of a div element and apply a border to them. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <p>one</p> <div><p>two</p></div> <p>three</p> ​ <script> $( "div > p" ).css( "border", "1px solid gray" ); </script> </body> </html> ``` * @example ​ ````Find all inputs of type radio within the first form in the document. ```javascript $( "input:radio", document.forms[ 0 ] ); ``` * @example ​ ````Find all div elements within an XML document from an Ajax response. ```javascript $( "div", xml.responseXML ); ``` ​ */ // tslint:disable-next-line:no-unnecessary-generics <TElement extends Element = HTMLElement>(selector: JQuery.Selector, context?: Element | Document | JQuery): JQuery<TElement>; /** * Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string. * @param element A DOM element to wrap in a jQuery object. * @see \`{@link https://api.jquery.com/jQuery/ }\` * @since 1.0 * @example ​ ````Set the background color of the page to black. ```javascript $( document.body ).css( "background", "black" ); ``` */ // NOTE: `HTMLSelectElement` is both an Element and an Array-Like Object but jQuery treats it as an Element. (element: HTMLSelectElement): JQuery<HTMLSelectElement>; /** * Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string. * @param element_elementArray _&#x40;param_ `element_elementArray` * <br> * * `element` — A DOM element to wrap in a jQuery object. <br> * * `elementArray` — An array containing a set of DOM elements to wrap in a jQuery object. * @see \`{@link https://api.jquery.com/jQuery/ }\` * @since 1.0 * @example ​ ````Set the background color of the page to black. ```javascript $( document.body ).css( "background", "black" ); ``` * @example ​ ````Hide all the input elements within a form. ```javascript $( myForm.elements ).hide(); ``` */ <T extends Element>(element_elementArray: T | ArrayLike<T>): JQuery<T>; /** * Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string. * @param selection An existing jQuery object to clone. * @see \`{@link https://api.jquery.com/jQuery/ }\` * @since 1.0 */ <T>(selection: JQuery<T>): JQuery<T>; /** * Binds a function to be executed when the DOM has finished loading. * @param callback The function to execute when the DOM is ready. * @see \`{@link https://api.jquery.com/jQuery/ }\` * @since 1.0 * @example ​ ````Execute the function when the DOM is ready to be used. ```javascript $(function() { // Document is ready }); ``` * @example ​ ````Use both the shortcut for $(document).ready() and the argument to write failsafe jQuery code using the $ alias, without relying on the global alias. ```javascript jQuery(function( $ ) { // Your code using failsafe $ alias here... }); ``` */ // tslint:disable-next-line:no-unnecessary-generics unified-signatures <TElement = HTMLElement>(callback: ((this: Document, $: JQueryStatic) => void)): JQuery<TElement>; /** * Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string. * @param object A plain object to wrap in a jQuery object. * @see \`{@link https://api.jquery.com/jQuery/ }\` * @since 1.0 */ <T extends JQuery.PlainObject>(object: T): JQuery<T>; /** * Returns an empty jQuery set. * @see \`{@link https://api.jquery.com/jQuery/ }\` * @since 1.4 */ // tslint:disable-next-line:no-unnecessary-generics <TElement = HTMLElement>(): JQuery<TElement>; /** * Perform an asynchronous HTTP (Ajax) request. * @param url A string containing the URL to which the request is sent. * @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(). See jQuery.ajax( settings ) below for a complete list of all settings. * @see \`{@link https://api.jquery.com/jQuery.ajax/ }\` * @since 1.5 */ ajax(url: string, settings?: JQuery.AjaxSettings): JQuery.jqXHR; /** * Perform an asynchronous HTTP (Ajax) request. * @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(). * @see \`{@link https://api.jquery.com/jQuery.ajax/ }\` * @since 1.0 * @example ​ ````Save some data to the server and notify the user once it&#39;s complete. ```javascript $.ajax({ method: "POST", url: "some.php", data: { name: "John", location: "Boston" } }) .done(function( msg ) { alert( "Data Saved: " + msg ); }); ``` * @example ​ ````Retrieve the latest version of an HTML page. ```javascript $.ajax({ url: "test.html", cache: false }) .done(function( html ) { $( "#results" ).append( html ); }); ``` * @example ​ ````Send an xml document as data to the server. By setting the processData option to false, the automatic conversion of data to strings is prevented. ```javascript var xmlDocument = [create xml document]; var xmlRequest = $.ajax({ url: "page.php", processData: false, data: xmlDocument }); ​ xmlRequest.done( handleResponse ); ``` * @example ​ ````Send an id as data to the server, save some data to the server, and notify the user once it&#39;s complete. If the request fails, alert the user. ```javascript var menuId = $( "ul.nav" ).first().attr( "id" ); var request = $.ajax({ url: "script.php", method: "POST", data: { id : menuId }, dataType: "html" }); ​ request.done(function( msg ) { $( "#log" ).html( msg ); }); ​ request.fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); }); ``` * @example ​ ````Load and execute a JavaScript file. ```javascript $.ajax({ method: "GET", url: "test.js", dataType: "script" }); ``` */ ajax(settings?: JQuery.AjaxSettings): JQuery.jqXHR; /** * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). * @param dataTypes An optional string containing one or more space-separated dataTypes * @param handler A handler to set default values for future Ajax requests. * @see \`{@link https://api.jquery.com/jQuery.ajaxPrefilter/ }\` * @since 1.5 */ ajaxPrefilter(dataTypes: string, handler: (options: JQuery.AjaxSettings, originalOptions: JQuery.AjaxSettings, jqXHR: JQuery.jqXHR) => string | void): void; /** * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). * @param handler A handler to set default values for future Ajax requests. * @see \`{@link https://api.jquery.com/jQuery.ajaxPrefilter/ }\` * @since 1.5 */ ajaxPrefilter(handler: (options: JQuery.AjaxSettings, originalOptions: JQuery.AjaxSettings, jqXHR: JQuery.jqXHR) => string | void): void; /** * Set default values for future Ajax requests. Its use is not recommended. * @param options A set of key/value pairs that configure the default Ajax request. All options are optional. * @see \`{@link https://api.jquery.com/jQuery.ajaxSetup/ }\` * @since 1.1 * @example ​ ````Sets the defaults for Ajax requests to the url &quot;/xmlhttp/&quot;, disables global handlers and uses POST instead of GET. The following Ajax requests then sends some data without having to set anything else. ```javascript $.ajaxSetup({ url: "/xmlhttp/", global: false, type: "POST" }); $.ajax({ data: myData }); ``` */ ajaxSetup(options: JQuery.AjaxSettings): JQuery.AjaxSettings; /** * Creates an object that handles the actual transmission of Ajax data. * @param dataType A string identifying the data type to use * @param handler A handler to return the new transport object to use with the data type provided in the first argument. * @see \`{@link https://api.jquery.com/jQuery.ajaxTransport/ }\` * @since 1.5 */ ajaxTransport(dataType: string, handler: (options: JQuery.AjaxSettings, originalOptions: JQuery.AjaxSettings, jqXHR: JQuery.jqXHR) => JQuery.Transport | void): void; /** * @deprecated ​ Deprecated since 3.3. Internal. See \`{@link https://github.com/jquery/jquery/issues/3384 }\`. */ camelCase(value: string): string; cleanData(elems: ArrayLike<Element | Document | Window | JQuery.PlainObject>): void; /** * Check to see if a DOM element is a descendant of another DOM element. * @param container The DOM element that may contain the other element. * @param contained The DOM element that may be contained by (a descendant of) the other element. * @see \`{@link https://api.jquery.com/jQuery.contains/ }\` * @since 1.4 * @example ​ ````Check if an element is a descendant of another. ```javascript $.contains( document.documentElement, document.body ); // true $.contains( document.body, document.documentElement ); // false ``` */ contains(container: Element, contained: Element): boolean; css(elem: Element, name: string): any; /** * Store arbitrary data associated with the specified element. Returns the value that was set. * @param element The DOM element to associate with the data. * @param key A string naming the piece of data to set. * @param value The new data value; this can be any Javascript type except `undefined`. * @see \`{@link https://api.jquery.com/jQuery.data/ }\` * @since 1.2.3 * @example ​ ````Get the data named &quot;blah&quot; stored at for an element. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.data demo</title> <style> div { margin: 5px; background: yellow; } button { margin: 5px; font-size: 14px; } p { margin: 5px; color: blue; } span { color: red; } </style> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div>A div</div> <button>Get "blah" from the div</button> <button>Set "blah" to "hello"</button> <button>Set "blah" to 86</button> <button>Remove "blah" from the div</button> <p>The "blah" value of this div is <span>?</span></p> ​ <script> $( "button" ).click( function() { var value, div = $( "div" )[ 0 ]; switch ( $( "button" ).index( this ) ) { case 0 : value = jQuery.data( div, "blah" ); break; case 1 : jQuery.data( div, "blah", "hello" ); value = "Stored!"; break; case 2 : jQuery.data( div, "blah", 86 ); value = "Stored!"; break; case 3 : jQuery.removeData( div, "blah" ); value = "Removed!"; break; } $( "span" ).text( "" + value ); }); </script> ​ </body> </html> ``` */ data<T extends string | number | boolean | symbol | object | null>(element: Element | Document | Window | JQuery.PlainObject, key: string, value: T): T; /** * 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. * @param element The DOM element to query for the data. * @param key Name of the data stored. * @param value `undefined` is not recognized as a data value. Calls such as `jQuery.data( el, "name", undefined )` * will return the corresponding data for "name", and is therefore the same as `jQuery.data( el, "name" )` * @see \`{@link https://api.jquery.com/jQuery.data/ }\` * @since 1.2.3 */ // `unified-signatures` is disabled so that behavior when passing `undefined` to `value` can be documented. Unifying the signatures // results in potential confusion for users from an unexpected parameter. // tslint:disable-next-line:unified-signatures data(element: Element | Document | Window | JQuery.PlainObject, key: string, value: undefined): any; /** * 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. * @param element The DOM element to query for the data. * @param key Name of the data stored. * @see \`{@link https://api.jquery.com/jQuery.data/ }\` * @since 1.2.3 * @since 1.4 * @example ​ ````Store then retrieve a value from the div element. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.data demo</title> <style> div { color: blue; } span { color: red; } </style> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div> The values stored were <span></span> and <span></span> </div> ​ <script> var div = $( "div" )[ 0 ]; jQuery.data( div, "test", { first: 16, last: "pizza!" }); $( "span:first" ).text( jQuery.data( div, "test" ).first ); $( "span:last" ).text( jQuery.data( div, "test" ).last ); </script> ​ </body> </html> ``` */ data(element: Element | Document | Window | JQuery.PlainObject, key?: string): any; /** * Execute the next function on the queue for the matched element. * @param element A DOM element from which to remove and execute a queued function. * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. * @see \`{@link https://api.jquery.com/jQuery.dequeue/ }\` * @since 1.3 * @example ​ ````Use jQuery.dequeue() to end a custom queue function which allows the queue to keep going. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.dequeue demo</title> <style> div { margin: 3px; width: 50px; position: absolute; height: 50px; left: 10px; top: 30px; background-color: yellow; } div.red { background-color: red; } </style> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <button>Start</button> <div></div> ​ <script> $( "button" ).click(function() { $( "div" ) .animate({ left: '+=200px' }, 2000 ) .animate({ top: '0px' }, 600 ) .queue(function() { $( this ).toggleClass( "red" ); $.dequeue( this ); }) .animate({ left:'10px', top:'30px' }, 700 ); }); </script> ​ </body> </html> ``` */ dequeue(element: Element, queueName?: string): void; /** * 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. * @param array The array to iterate over. * @param callback The function that will be executed on every object. * @see \`{@link https://api.jquery.com/jQuery.each/ }\` * @since 1.0 * @example ​ ````Iterates through the array displaying each number as both a word and numeral ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.each demo</title> <style> div { color: blue; } div#five { color: red; } </style> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="one"></div> <div id="two"></div> <div id="three"></div> <div id="four"></div> <div id="five"></div> ​ <script> var arr = [ "one", "two", "three", "four", "five" ]; var obj = { one: 1, two: 2, three: 3, four: 4, five: 5 }; ​ jQuery.each( arr, function( i, val ) { $( "#" + val ).text( "Mine is " + val + "." ); ​ // Will stop running after "three" return ( val !== "three" ); }); ​ jQuery.each( obj, function( i, val ) { $( "#" + i ).append( document.createTextNode( " - " + val ) ); }); </script> ​ </body> </html> ``` * @example ​ ````Iterates over items in an array, accessing both the current item and its index. ```javascript $.each( [ "a", "b", "c" ], function( i, l ){ alert( "Index #" + i + ": " + l ); }); ``` */ each<T>(array: ArrayLike<T>, callback: (this: T, indexInArray: number, value: T) => any): ArrayLike<T>; /** * 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. * @param obj The object to iterate over. * @param callback The function that will be executed on every object. * @see \`{@link https://api.jquery.com/jQuery.each/ }\` * @since 1.0 * @example ​ ````Iterates through the array displaying each number as both a word and numeral ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.each demo</title> <style> div { color: blue; } div#five { color: red; } </style> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="one"></div> <div id="two"></div> <div id="three"></div> <div id="four"></div> <div id="five"></div> ​ <script> var arr = [ "one", "two", "three", "four", "five" ]; var obj = { one: 1, two: 2, three: 3, four: 4, five: 5 }; ​ jQuery.each( arr, function( i, val ) { $( "#" + val ).text( "Mine is " + val + "." ); ​ // Will stop running after "three" return ( val !== "three" ); }); ​ jQuery.each( obj, function( i, val ) { $( "#" + i ).append( document.createTextNode( " - " + val ) ); }); </script> ​ </body> </html> ``` * @example ​ ````Iterates over the properties in an object, accessing both the current item and its key. ```javascript $.each({ name: "John", lang: "JS" }, function( k, v ) { alert( "Key: " + k + ", Value: " + v ); }); ``` */ each<T, K extends keyof T>(obj: T, callback: (this: T[K], propertyName: K, valueOfProperty: T[K]) => any): T; /** * Takes a string and throws an exception containing it. * @param message The message to send out. * @see \`{@link https://api.jquery.com/jQuery.error/ }\` * @since 1.4.1 * @example ​ ````Override jQuery.error for display in Firebug. ```javascript jQuery.error = console.error; ``` */ error(message: string): any; /** * Escapes any character that has a special meaning in a CSS selector. * @param selector A string containing a selector expression to escape. * @see \`{@link https://api.jquery.com/jQuery.escapeSelector/ }\` * @since 3.0 * @example ​ ````Escape an ID containing a hash. ```javascript $.escapeSelector( "#target" ); // "\#target" ``` * @example ​ ````Select all the elements having a class name of .box inside a div. ```javascript $( "div" ).find( "." + $.escapeSelector( ".box" ) ); ``` */ escapeSelector(selector: JQuery.Selector): JQuery.Selector; /** * Merge the contents of two or more objects together into the first object. * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. * @param target The object to extend. It will receive the new properties. * @param object1 An object containing additional properties to merge in. * @param object2 An object containing additional properties to merge in. * @param object3 An object containing additional properties to merge in. * @param object4 An object containing additional properties to merge in. * @param object5 An object containing additional properties to merge in. * @param object6 An object containing additional properties to merge in. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.1.4 * @example ​ ````Merge two objects recursively, modifying the first. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var object1 = { apple: 0, banana: { weight: 52, price: 100 }, cherry: 97 }; var object2 = { banana: { price: 200 }, durian: 100 }; ​ // Merge object2 into object1, recursively $.extend( true, object1, object2 ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( JSON.stringify( object1 ) ); </script> ​ </body> </html> ``` */ extend<T, U, V, W, X, Y, Z>(deep: true, target: T, object1: U, object2: V, object3: W, object4: X, object5: Y, object6: Z): T & U & V & W & X & Y & Z; /** * Merge the contents of two or more objects together into the first object. * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. * @param target The object to extend. It will receive the new properties. * @param object1 An object containing additional properties to merge in. * @param object2 An object containing additional properties to merge in. * @param object3 An object containing additional properties to merge in. * @param object4 An object containing additional properties to merge in. * @param object5 An object containing additional properties to merge in. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.1.4 * @example ​ ````Merge two objects recursively, modifying the first. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var object1 = { apple: 0, banana: { weight: 52, price: 100 }, cherry: 97 }; var object2 = { banana: { price: 200 }, durian: 100 }; ​ // Merge object2 into object1, recursively $.extend( true, object1, object2 ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( JSON.stringify( object1 ) ); </script> ​ </body> </html> ``` */ extend<T, U, V, W, X, Y>(deep: true, target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y; /** * Merge the contents of two or more objects together into the first object. * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. * @param target The object to extend. It will receive the new properties. * @param object1 An object containing additional properties to merge in. * @param object2 An object containing additional properties to merge in. * @param object3 An object containing additional properties to merge in. * @param object4 An object containing additional properties to merge in. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.1.4 * @example ​ ````Merge two objects recursively, modifying the first. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var object1 = { apple: 0, banana: { weight: 52, price: 100 }, cherry: 97 }; var object2 = { banana: { price: 200 }, durian: 100 }; ​ // Merge object2 into object1, recursively $.extend( true, object1, object2 ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( JSON.stringify( object1 ) ); </script> ​ </body> </html> ``` */ extend<T, U, V, W, X>(deep: true, target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X; /** * Merge the contents of two or more objects together into the first object. * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. * @param target The object to extend. It will receive the new properties. * @param object1 An object containing additional properties to merge in. * @param object2 An object containing additional properties to merge in. * @param object3 An object containing additional properties to merge in. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.1.4 * @example ​ ````Merge two objects recursively, modifying the first. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var object1 = { apple: 0, banana: { weight: 52, price: 100 }, cherry: 97 }; var object2 = { banana: { price: 200 }, durian: 100 }; ​ // Merge object2 into object1, recursively $.extend( true, object1, object2 ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( JSON.stringify( object1 ) ); </script> ​ </body> </html> ``` */ extend<T, U, V, W>(deep: true, target: T, object1: U, object2: V, object3: W): T & U & V & W; /** * Merge the contents of two or more objects together into the first object. * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. * @param target The object to extend. It will receive the new properties. * @param object1 An object containing additional properties to merge in. * @param object2 An object containing additional properties to merge in. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.1.4 * @example ​ ````Merge two objects recursively, modifying the first. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var object1 = { apple: 0, banana: { weight: 52, price: 100 }, cherry: 97 }; var object2 = { banana: { price: 200 }, durian: 100 }; ​ // Merge object2 into object1, recursively $.extend( true, object1, object2 ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( JSON.stringify( object1 ) ); </script> ​ </body> </html> ``` */ extend<T, U, V>(deep: true, target: T, object1: U, object2: V): T & U & V; /** * Merge the contents of two or more objects together into the first object. * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. * @param target The object to extend. It will receive the new properties. * @param object1 An object containing additional properties to merge in. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.1.4 * @example ​ ````Merge two objects recursively, modifying the first. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var object1 = { apple: 0, banana: { weight: 52, price: 100 }, cherry: 97 }; var object2 = { banana: { price: 200 }, durian: 100 }; ​ // Merge object2 into object1, recursively $.extend( true, object1, object2 ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( JSON.stringify( object1 ) ); </script> ​ </body> </html> ``` */ extend<T, U>(deep: true, target: T, object1: U): T & U; /** * Merge the contents of two or more objects together into the first object. * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. * @param target The object to extend. It will receive the new properties. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.1.4 */ extend<T>(deep: true, target: T): this & T; /** * Merge the contents of two or more objects together into the first object. * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. * @param target The object to extend. It will receive the new properties. * @param object1 An object containing additional properties to merge in. * @param objectN Additional objects containing properties to merge in. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.1.4 * @example ​ ````Merge two objects recursively, modifying the first. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var object1 = { apple: 0, banana: { weight: 52, price: 100 }, cherry: 97 }; var object2 = { banana: { price: 200 }, durian: 100 }; ​ // Merge object2 into object1, recursively $.extend( true, object1, object2 ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( JSON.stringify( object1 ) ); </script> ​ </body> </html> ``` */ extend(deep: true, target: any, object1: any, ...objectN: any[]): any; /** * Merge the contents of two or more objects together into the first object. * @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. * @param object1 An object containing additional properties to merge in. * @param object2 An object containing additional properties to merge in. * @param object3 An object containing additional properties to merge in. * @param object4 An object containing additional properties to merge in. * @param object5 An object containing additional properties to merge in. * @param object6 An object containing additional properties to merge in. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.0 * @example ​ ````Merge two objects, modifying the first. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var object1 = { apple: 0, banana: { weight: 52, price: 100 }, cherry: 97 }; var object2 = { banana: { price: 200 }, durian: 100 }; ​ // Merge object2 into object1 $.extend( object1, object2 ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( JSON.stringify( object1 ) ); </script> ​ </body> </html> ``` * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var defaults = { validate: false, limit: 5, name: "foo" }; var options = { validate: true, name: "bar" }; ​ // Merge defaults and options, without modifying defaults var settings = $.extend( {}, defaults, options ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" ); $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" ); $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" ); </script> ​ </body> </html> ``` */ extend<T, U, V, W, X, Y, Z>(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y, object6: Z): T & U & V & W & X & Y & Z; /** * Merge the contents of two or more objects together into the first object. * @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. * @param object1 An object containing additional properties to merge in. * @param object2 An object containing additional properties to merge in. * @param object3 An object containing additional properties to merge in. * @param object4 An object containing additional properties to merge in. * @param object5 An object containing additional properties to merge in. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.0 * @example ​ ````Merge two objects, modifying the first. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var object1 = { apple: 0, banana: { weight: 52, price: 100 }, cherry: 97 }; var object2 = { banana: { price: 200 }, durian: 100 }; ​ // Merge object2 into object1 $.extend( object1, object2 ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( JSON.stringify( object1 ) ); </script> ​ </body> </html> ``` * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var defaults = { validate: false, limit: 5, name: "foo" }; var options = { validate: true, name: "bar" }; ​ // Merge defaults and options, without modifying defaults var settings = $.extend( {}, defaults, options ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" ); $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" ); $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" ); </script> ​ </body> </html> ``` */ extend<T, U, V, W, X, Y>(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y; /** * Merge the contents of two or more objects together into the first object. * @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. * @param object1 An object containing additional properties to merge in. * @param object2 An object containing additional properties to merge in. * @param object3 An object containing additional properties to merge in. * @param object4 An object containing additional properties to merge in. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.0 * @example ​ ````Merge two objects, modifying the first. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var object1 = { apple: 0, banana: { weight: 52, price: 100 }, cherry: 97 }; var object2 = { banana: { price: 200 }, durian: 100 }; ​ // Merge object2 into object1 $.extend( object1, object2 ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( JSON.stringify( object1 ) ); </script> ​ </body> </html> ``` * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var defaults = { validate: false, limit: 5, name: "foo" }; var options = { validate: true, name: "bar" }; ​ // Merge defaults and options, without modifying defaults var settings = $.extend( {}, defaults, options ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" ); $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" ); $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" ); </script> ​ </body> </html> ``` */ extend<T, U, V, W, X>(target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X; /** * Merge the contents of two or more objects together into the first object. * @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. * @param object1 An object containing additional properties to merge in. * @param object2 An object containing additional properties to merge in. * @param object3 An object containing additional properties to merge in. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.0 * @example ​ ````Merge two objects, modifying the first. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var object1 = { apple: 0, banana: { weight: 52, price: 100 }, cherry: 97 }; var object2 = { banana: { price: 200 }, durian: 100 }; ​ // Merge object2 into object1 $.extend( object1, object2 ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( JSON.stringify( object1 ) ); </script> ​ </body> </html> ``` * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var defaults = { validate: false, limit: 5, name: "foo" }; var options = { validate: true, name: "bar" }; ​ // Merge defaults and options, without modifying defaults var settings = $.extend( {}, defaults, options ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" ); $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" ); $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" ); </script> ​ </body> </html> ``` */ extend<T, U, V, W>(target: T, object1: U, object2: V, object3: W): T & U & V & W; /** * Merge the contents of two or more objects together into the first object. * @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. * @param object1 An object containing additional properties to merge in. * @param object2 An object containing additional properties to merge in. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.0 * @example ​ ````Merge two objects, modifying the first. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var object1 = { apple: 0, banana: { weight: 52, price: 100 }, cherry: 97 }; var object2 = { banana: { price: 200 }, durian: 100 }; ​ // Merge object2 into object1 $.extend( object1, object2 ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( JSON.stringify( object1 ) ); </script> ​ </body> </html> ``` * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var defaults = { validate: false, limit: 5, name: "foo" }; var options = { validate: true, name: "bar" }; ​ // Merge defaults and options, without modifying defaults var settings = $.extend( {}, defaults, options ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" ); $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" ); $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" ); </script> ​ </body> </html> ``` */ extend<T, U, V>(target: T, object1: U, object2: V): T & U & V; /** * Merge the contents of two or more objects together into the first object. * @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. * @param object1 An object containing additional properties to merge in. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.0 * @example ​ ````Merge two objects, modifying the first. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var object1 = { apple: 0, banana: { weight: 52, price: 100 }, cherry: 97 }; var object2 = { banana: { price: 200 }, durian: 100 }; ​ // Merge object2 into object1 $.extend( object1, object2 ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( JSON.stringify( object1 ) ); </script> ​ </body> </html> ``` * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var defaults = { validate: false, limit: 5, name: "foo" }; var options = { validate: true, name: "bar" }; ​ // Merge defaults and options, without modifying defaults var settings = $.extend( {}, defaults, options ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" ); $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" ); $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" ); </script> ​ </body> </html> ``` */ extend<T, U>(target: T, object1: U): T & U; /** * Merge the contents of two or more objects together into the first object. * @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. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.0 */ extend<T>(target: T): this & T; /** * Merge the contents of two or more objects together into the first object. * @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. * @param object1 An object containing additional properties to merge in. * @param objectN Additional objects containing properties to merge in. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.0 * @example ​ ````Merge two objects, modifying the first. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head> <body> ​ <div id="log"></div> ​ <script> var object1 = { apple: 0, banana: { weight: 52, price: 100 }, cherry: 97 }; var object2 = { banana: { price: 200 }, durian: 100 }; ​ // Merge object2 into object1 $.extend( object1, object2 ); ​ // Assuming JSON.stringify - not available in IE<8 $( "#log" ).append( JSON.stringify( object1 ) ); </script> ​ </body> </html> ``` * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern. ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery.extend demo</title> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> </head>