: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
// Support: Promises/A+ section 2.3.4
// https://promisesaplus.com/#point-64
// Only check objects and functions for thenability
( typeof returned === "object" ||
typeof returned === "function" ) &&
// Handle a returned thenable
if ( isFunction( then ) ) {
// Special processors (notify) just wait for resolution
resolve( maxDepth, deferred, Identity, special ),
resolve( maxDepth, deferred, Thrower, special )
// Normal processors (resolve) also hook into progress
// ...and disregard older resolution values
resolve( maxDepth, deferred, Identity, special ),
resolve( maxDepth, deferred, Thrower, special ),
resolve( maxDepth, deferred, Identity,
// Handle all other returned values
// Only substitute handlers pass on context
// and multiple values (non-spec behavior)
if ( handler !== Identity ) {
// Default process is resolve
( special || deferred.resolveWith )( that, args );
// Only normal processors (resolve) catch and reject exceptions
if ( jQuery.Deferred.exceptionHook ) {
jQuery.Deferred.exceptionHook( e,
// Support: Promises/A+ section 2.3.3.3.4.1
// https://promisesaplus.com/#point-61
// Ignore post-resolution exceptions
if ( depth + 1 >= maxDepth ) {
// Only substitute handlers pass on context
// and multiple values (non-spec behavior)
if ( handler !== Thrower ) {
deferred.rejectWith( that, args );
// Support: Promises/A+ section 2.3.3.3.1
// https://promisesaplus.com/#point-57
// Re-resolve promises immediately to dodge false rejection from
// Call an optional hook to record the error, in case of exception
// since it's otherwise lost when execution goes async
if ( jQuery.Deferred.getErrorHook ) {
process.error = jQuery.Deferred.getErrorHook();
// The deprecated alias of the above. While the name suggests
// returning the stack, not an error instance, jQuery just passes
// it directly to `console.warn` so both will work; an instance
// just better cooperates with source maps.
} else if ( jQuery.Deferred.getStackHook ) {
process.error = jQuery.Deferred.getStackHook();
window.setTimeout( process );
return jQuery.Deferred( function( newDefer ) {
// progress_handlers.add( ... )
isFunction( onProgress ) ?
// fulfilled_handlers.add( ... )
isFunction( onFulfilled ) ?
// rejected_handlers.add( ... )
isFunction( onRejected ) ?
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
return obj != null ? jQuery.extend( obj, promise ) : promise;
// Add list-specific methods
jQuery.each( tuples, function( i, tuple ) {
stateString = tuple[ 5 ];
// promise.progress = list.add
// promise.done = list.add
// promise.fail = list.add
promise[ tuple[ 1 ] ] = list.add;
// state = "resolved" (i.e., fulfilled)
// rejected_callbacks.disable
// fulfilled_callbacks.disable
tuples[ 3 - i ][ 2 ].disable,
// rejected_handlers.disable
// fulfilled_handlers.disable
tuples[ 3 - i ][ 3 ].disable,
// progress_callbacks.lock
// progress_handlers.lock
// progress_handlers.fire
// fulfilled_handlers.fire
// rejected_handlers.fire
list.add( tuple[ 3 ].fire );
// deferred.notify = function() { deferred.notifyWith(...) }
// deferred.resolve = function() { deferred.resolveWith(...) }
// deferred.reject = function() { deferred.rejectWith(...) }
deferred[ tuple[ 0 ] ] = function() {
deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
// deferred.notifyWith = list.fireWith
// deferred.resolveWith = list.fireWith
// deferred.rejectWith = list.fireWith
deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
// Make the deferred a promise
promise.promise( deferred );
// Call given func if any
func.call( deferred, deferred );
when: function( singleValue ) {
// count of uncompleted subordinates
remaining = arguments.length,
// count of unprocessed arguments
// subordinate fulfillment data
resolveContexts = Array( i ),
resolveValues = slice.call( arguments ),
primary = jQuery.Deferred(),
// subordinate callback factory
updateFunc = function( i ) {
return function( value ) {
resolveContexts[ i ] = this;
resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
if ( !( --remaining ) ) {
primary.resolveWith( resolveContexts, resolveValues );
// Single- and empty arguments are adopted like Promise.resolve
adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject,
// Use .then() to unwrap secondary thenables (cf. gh-3000)
if ( primary.state() === "pending" ||
isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
// Multiple arguments are aggregated like Promise.all array elements
adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject );
return primary.promise();
// These usually indicate a programmer mistake during development,
// warn about them ASAP rather than swallowing them by default.
var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error
// captured before the async barrier to get the original error cause
// which may otherwise be hidden.
jQuery.Deferred.exceptionHook = function( error, asyncError ) {
// Support: IE 8 - 9 only
// Console exists when dev tools are open, which can happen at any time
if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
window.console.warn( "jQuery.Deferred exception: " + error.message,
error.stack, asyncError );
jQuery.readyException = function( error ) {
window.setTimeout( function() {
// The deferred used on DOM ready
var readyList = jQuery.Deferred();
jQuery.fn.ready = function( fn ) {
// Wrap jQuery.readyException in a function so that the lookup
// happens at the time of error handling instead of callback
.catch( function( error ) {
jQuery.readyException( error );
// Is the DOM ready to be used? Set to true once it occurs.
// A counter to track how many items to wait for before
// the ready event fires. See trac-6781
// Handle when the DOM is ready
ready: function( wait ) {
// Abort if there are pending holds or we're already ready
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
// Remember that the DOM is ready
// If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) {
// If there are functions bound, to execute
readyList.resolveWith( document, [ jQuery ] );
jQuery.ready.then = readyList.then;
// The ready event handler and self cleanup method
document.removeEventListener( "DOMContentLoaded", completed );
window.removeEventListener( "load", completed );
// Catch cases where $(document).ready() is called
// after the browser event has already occurred.
// Support: IE <=9 - 10 only
// Older IE sometimes signals "interactive" too soon
if ( document.readyState === "complete" ||
( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
window.setTimeout( jQuery.ready );
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed );
// A fallback to window.onload, that will always work
window.addEventListener( "load", completed );
// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
if ( toType( key ) === "object" ) {
access( elems, fn, i, key[ i ], true, emptyGet, raw );
} else if ( value !== undefined ) {
if ( !isFunction( value ) ) {
// Bulk operations run against the entire set
// ...except when executing function values
fn = function( elem, _key, value ) {
return bulk.call( jQuery( elem ), value );
value.call( elems[ i ], i, fn( elems[ i ], key ) )
return len ? fn( elems[ 0 ], key ) : emptyGet;
// Matches dashed string for camelizing
rdashAlpha = /-([a-z])/g;
// Used by camelCase as callback to replace()
function fcamelCase( _all, letter ) {
return letter.toUpperCase();
// Convert dashed to camelCase; used by the css and data modules
// Support: IE <=9 - 11, Edge 12 - 15
// Microsoft forgot to hump their vendor prefix (trac-9572)
function camelCase( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
var acceptData = function( owner ) {
return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
this.expando = jQuery.expando + Data.uid++;
cache: function( owner ) {
// Check if the owner object already has a cache
var value = owner[ this.expando ];
// We can accept data for non-element nodes in modern browsers,
// but we should not, see trac-8335.
// Always return an empty object.
if ( acceptData( owner ) ) {
// If it is a node unlikely to be stringify-ed or looped over
owner[ this.expando ] = value;
// Otherwise secure it in a non-enumerable property
// configurable must be true to allow the property to be
// deleted when data is removed