: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
// Always skip document fragments
if ( cur.nodeType < 11 && ( targets ?
targets.index( cur ) > -1 :
// Don't pass non-elements to jQuery#find
jQuery.find.matchesSelector( cur, selectors ) ) ) {
return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
// Determine the position of an element within the set
index: function( elem ) {
// No argument, return index in parent
return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
if ( typeof elem === "string" ) {
return indexOf.call( jQuery( elem ), this[ 0 ] );
// Locate the position of the desired element
return indexOf.call( this,
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[ 0 ] : elem
add: function( selector, context ) {
jQuery.merge( this.get(), jQuery( selector, context ) )
addBack: function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter( selector )
function sibling( cur, dir ) {
while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
parents: function( elem ) {
return dir( elem, "parentNode" );
parentsUntil: function( elem, _i, until ) {
return dir( elem, "parentNode", until );
return sibling( elem, "nextSibling" );
return sibling( elem, "previousSibling" );
nextAll: function( elem ) {
return dir( elem, "nextSibling" );
prevAll: function( elem ) {
return dir( elem, "previousSibling" );
nextUntil: function( elem, _i, until ) {
return dir( elem, "nextSibling", until );
prevUntil: function( elem, _i, until ) {
return dir( elem, "previousSibling", until );
siblings: function( elem ) {
return siblings( ( elem.parentNode || {} ).firstChild, elem );
children: function( elem ) {
return siblings( elem.firstChild );
contents: function( elem ) {
if ( elem.contentDocument != null &&
// <object> elements with no `data` attribute has an object
// `contentDocument` with a `null` prototype.
getProto( elem.contentDocument ) ) {
return elem.contentDocument;
// Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
// Treat the template element as a regular one in browsers that
if ( nodeName( elem, "template" ) ) {
elem = elem.content || elem;
return jQuery.merge( [], elem.childNodes );
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var matched = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
if ( selector && typeof selector === "string" ) {
matched = jQuery.filter( selector, matched );
if ( !guaranteedUnique[ name ] ) {
jQuery.uniqueSort( matched );
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
return this.pushStack( matched );
var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
// Convert String-formatted options into Object-formatted ones
function createOptions( options ) {
jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
* Create a callback list using the following parameters:
* options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option object
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
* once: will ensure the callback list can only be fired once (like a Deferred)
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
* unique: will ensure a callback can only be added once (no duplicate in the list)
* stopOnFalse: interrupt callings when a callback returns false
jQuery.Callbacks = function( options ) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?
createOptions( options ) :
jQuery.extend( {}, options );
var // Flag to know if list is currently firing
// Last fire value for non-forgettable lists
// Flag to know if list was already fired
// Flag to prevent firing
// Queue of execution data for repeatable lists
// Index of currently firing callback (modified by add/remove as needed)
locked = locked || options.once;
// Execute callbacks for all pending executions,
// respecting firingIndex overrides and runtime changes
for ( ; queue.length; firingIndex = -1 ) {
while ( ++firingIndex < list.length ) {
// Run callback and check for early termination
if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
// Jump to end and forget the data so .add doesn't re-fire
firingIndex = list.length;
// Forget the data if we're done with it
// Clean up if we're done firing for good
// Keep an empty list if we have data for future add calls
// Otherwise, this object is spent
// Actual Callbacks object
// Add a callback or a collection of callbacks to the list
// If we have memory from a past run, we should fire after adding
if ( memory && !firing ) {
firingIndex = list.length - 1;
jQuery.each( args, function( _, arg ) {
if ( isFunction( arg ) ) {
if ( !options.unique || !self.has( arg ) ) {
} else if ( arg && arg.length && toType( arg ) !== "string" ) {
if ( memory && !firing ) {
// Remove a callback from the list
jQuery.each( arguments, function( _, arg ) {
while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
if ( index <= firingIndex ) {
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
jQuery.inArray( fn, list ) > -1 :
// Remove all callbacks from the list
// Disable .fire and .add
// Abort any current/pending executions
// Clear all callbacks and values
// Also disable .add unless we have memory (since it would have no effect)
// Abort any pending executions
if ( !memory && !firing ) {
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
args = [ context, args.slice ? args.slice() : args ];
// Call all the callbacks with the given arguments
self.fireWith( this, arguments );
// To know if the callbacks have already been called at least once
function adoptValue( value, resolve, reject, noValue ) {
// Check for promise aspect first to privilege synchronous behavior
if ( value && isFunction( ( method = value.promise ) ) ) {
method.call( value ).done( resolve ).fail( reject );
} else if ( value && isFunction( ( method = value.then ) ) ) {
method.call( value, resolve, reject );
// Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
// * false: [ value ].slice( 0 ) => resolve( value )
// * true: [ value ].slice( 1 ) => resolve()
resolve.apply( undefined, [ value ].slice( noValue ) );
// For Promises/A+, convert exceptions into rejections
// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
// Deferred#then to conditionally suppress rejection.
// Support: Android 4.0 only
// Strict mode functions invoked without .call/.apply get global-object context
reject.apply( undefined, [ value ] );
Deferred: function( func ) {
// action, add listener, callbacks,
// ... .then handlers, argument index, [final state]
[ "notify", "progress", jQuery.Callbacks( "memory" ),
jQuery.Callbacks( "memory" ), 2 ],
[ "resolve", "done", jQuery.Callbacks( "once memory" ),
jQuery.Callbacks( "once memory" ), 0, "resolved" ],
[ "reject", "fail", jQuery.Callbacks( "once memory" ),
jQuery.Callbacks( "once memory" ), 1, "rejected" ]
deferred.done( arguments ).fail( arguments );
"catch": function( fn ) {
return promise.then( null, fn );
// Keep pipe for back-compat
pipe: function( /* fnDone, fnFail, fnProgress */ ) {
return jQuery.Deferred( function( newDefer ) {
jQuery.each( tuples, function( _i, tuple ) {
// Map tuples (progress, done, fail) to arguments (done, fail, progress)
var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
// deferred.progress(function() { bind to newDefer or newDefer.notify })
// deferred.done(function() { bind to newDefer or newDefer.resolve })
// deferred.fail(function() { bind to newDefer or newDefer.reject })
deferred[ tuple[ 1 ] ]( function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && isFunction( returned.promise ) ) {
.progress( newDefer.notify )
.done( newDefer.resolve )
.fail( newDefer.reject );
newDefer[ tuple[ 0 ] + "With" ](
fn ? [ returned ] : arguments
then: function( onFulfilled, onRejected, onProgress ) {
function resolve( depth, deferred, handler, special ) {
mightThrow = function() {
// Support: Promises/A+ section 2.3.3.3.3
// https://promisesaplus.com/#point-59
// Ignore double-resolution attempts
if ( depth < maxDepth ) {
returned = handler.apply( that, args );
// Support: Promises/A+ section 2.3.1
// https://promisesaplus.com/#point-48
if ( returned === deferred.promise() ) {
throw new TypeError( "Thenable self-resolution" );
// Support: Promises/A+ sections 2.3.3.1, 3.5
// https://promisesaplus.com/#point-54
// https://promisesaplus.com/#point-75
// Retrieve `then` only once