PageSourceSearch

https://www.bigshark.com/includes/js/jquery/jquery-migrate-3.0.1.js?v=fc234210e

js bigshark.com collected 2026-09-25 18:54:01 UTC 17,813 bytes, 626 lines download raw bytes

1/*!
2 * jQuery Migrate - v3.0.1 - 2017-09-26
3 * Copyright jQuery Foundation and other contributors
4 */
5;( function( factory ) {
6	if ( typeof define === "function" && define.amd ) {
7
8		// AMD. Register as an anonymous module.
9		define( [ "jquery" ], window, factory );
10	} else if ( typeof module === "object" && module.exports ) {
11
12		// Node/CommonJS
13		// eslint-disable-next-line no-undef
14		module.exports = factory( require( "jquery" ), window );
15	} else {
16
17		// Browser globals
18		factory( jQuery, window );
19	}
20} )( function( jQuery, window ) {
21"use strict";
22
23
24jQuery.migrateVersion = "3.0.1";
25
26/* exported migrateWarn, migrateWarnFunc, migrateWarnProp */
27
28( function() {
29
30	var rbadVersions = /^[12]\./;
31
32	// Support: IE9 only
33	// IE9 only creates console object when dev tools are first opened
34	// IE9 console is a host object, callable but doesn't have .apply()
35	if ( !window.console || !window.console.log ) {
36		return;
37	}
38
39	// Need jQuery 3.0.0+ and no older Migrate loaded
40	if ( !jQuery || rbadVersions.test( jQuery.fn.jquery ) ) {
41		window.console.log( "JQMIGRATE: jQuery 3.0.0+ REQUIRED" );
42	}
43	if ( jQuery.migrateWarnings ) {
44		window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" );
45	}
46
47	// Show a message on the console so devs know we're active
48	window.console.log( "JQMIGRATE: Migrate is installed" +
49		( jQuery.migrateMute ? "" : " with logging active" ) +
50		", version " + jQuery.migrateVersion );
51
52} )();
53
54var warnedAbout = {};
55
56// List of warnings already given; public read only
57jQuery.migrateWarnings = [];
58
59// Set to false to disable traces that appear with warnings
60if ( jQuery.migrateTrace === undefined ) {
61	jQuery.migrateTrace = true;
62}
63
64// Forget any warnings we've already given; public
65jQuery.migrateReset = function() {
66	warnedAbout = {};
67	jQuery.migrateWarnings.length = 0;
68};
69
70function migrateWarn( msg ) {
71	var console = window.console;
72	if ( !warnedAbout[ msg ] ) {
73		warnedAbout[ msg ] = true;
74		jQuery.migrateWarnings.push( msg );
75		if ( console && console.warn && !jQuery.migrateMute ) {
76			console.warn( "JQMIGRATE: " + msg );
77			if ( jQuery.migrateTrace && console.trace ) {
78				console.trace();
79			}
80		}
81	}
82}
83
84function migrateWarnProp( obj, prop, value, msg ) {
85	Object.defineProperty( obj, prop, {
86		configurable: true,
87		enumerable: true,
88		get: function() {
89			migrateWarn( msg );
90			return value;
91		},
92		set: function( newValue ) {
93			migrateWarn( msg );
94			value = newValue;
95		}
96	} );
97}
98
99function migrateWarnFunc( obj, prop, newFunc, msg ) {
100	obj[ prop ] = function() {
101		migrateWarn( msg );
102		return newFunc.apply( this, arguments );
103	};
104}
105
106if ( window.document.compatMode === "BackCompat" ) {
107
108	// JQuery has never supported or tested Quirks Mode
109	migrateWarn( "jQuery is not compatible with Quirks Mode" );
110}
111
112
113var oldInit = jQuery.fn.init,
114	oldIsNumeric = jQuery.isNumeric,
115	oldFind = jQuery.find,
116	rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,
117	rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g;
118
119jQuery.fn.init = function( arg1 ) {
120	var args = Array.prototype.slice.call( arguments );
121
122	if ( typeof arg1 === "string" && arg1 === "#" ) {
123
124		// JQuery( "#" ) is a bogus ID selector, but it returned an empty set before jQuery 3.0
125		migrateWarn( "jQuery( '#' ) is not a valid selector" );
126		args[ 0 ] = [];
127	}
128
129	return oldInit.apply( this, args );
130};
131jQuery.fn.init.prototype = jQuery.fn;
132
133jQuery.find = function( selector ) {
134	var args = Array.prototype.slice.call( arguments );
135
136	// Support: PhantomJS 1.x
137	// String#match fails to match when used with a //g RegExp, only on some strings
138	if ( typeof selector === "string" && rattrHashTest.test( selector ) ) {
139
140		// The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
141		// First see if qS thinks it's a valid selector, if so avoid a false positive
142		try {
143			window.document.querySelector( selector );
144		} catch ( err1 ) {
145
146			// Didn't *look* valid to qSA, warn and try quoting what we think is the value
147			selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) {
148				return "[" + attr + op + "\"" + value + "\"]";
149			} );
150
151			// If the regexp *may* have created an invalid selector, don't update it
152			// Note that there may be false alarms if selector uses jQuery extensions
153			try {
154				window.document.querySelector( selector );
155				migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] );
156				args[ 0 ] = selector;
157			} catch ( err2 ) {
158				migrateWarn( "Attribute selector with '#' was not fixed: " + args[ 0 ] );
159			}
160		}
161	}
162
163	return oldFind.apply( this, args );
164};
165
166// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML)
167var findProp;
168for ( findProp in oldFind ) {
169	if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) {
170		jQuery.find[ findProp ] = oldFind[ findProp ];
171	}
172}
173
174// The number of elements contained in the matched element set
175jQuery.fn.size = function() {
176	migrateWarn( "jQuery.fn.size() is deprecated and removed; use the .length property" );
177	return this.length;
178};
179
180jQuery.parseJSON = function() {
181	migrateWarn( "jQuery.parseJSON is deprecated; use JSON.parse" );
182	return JSON.parse.apply( null, arguments );
183};
184
185jQuery.isNumeric = function( val ) {
186
187	// The jQuery 2.2.3 implementation of isNumeric
188	function isNumeric2( obj ) {
189		var realStringObj = obj && obj.toString();
190		return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
191	}
192
193	var newValue = oldIsNumeric( val ),
194		oldValue = isNumeric2( val );
195
196	if ( newValue !== oldValue ) {
197		migrateWarn( "jQuery.isNumeric() should not be called on constructed objects" );
198	}
199
200	return oldValue;
201};
202
203migrateWarnFunc( jQuery, "holdReady", jQuery.holdReady,
204	"jQuery.holdReady is deprecated" );
205
206migrateWarnFunc( jQuery, "unique", jQuery.uniqueSort,
207	"jQuery.unique is deprecated; use jQuery.uniqueSort" );
208
209// Now jQuery.expr.pseudos is the standard incantation
210migrateWarnProp( jQuery.expr, "filters", jQuery.expr.pseudos,
211	"jQuery.expr.filters is deprecated; use jQuery.expr.pseudos" );
212migrateWarnProp( jQuery.expr, ":", jQuery.expr.pseudos,
213	"jQuery.expr[':'] is deprecated; use jQuery.expr.pseudos" );
214
215
216var oldAjax = jQuery.ajax;
217
218jQuery.ajax = function( ) {
219	var jQXHR = oldAjax.apply( this, arguments );
220
221	// Be sure we got a jQXHR (e.g., not sync)
222	if ( jQXHR.promise ) {
223		migrateWarnFunc( jQXHR, "success", jQXHR.done,
224			"jQXHR.success is deprecated and removed" );
225		migrateWarnFunc( jQXHR, "error", jQXHR.fail,
226			"jQXHR.error is deprecated and removed" );
227		migrateWarnFunc( jQXHR, "complete", jQXHR.always,
228			"jQXHR.complete is deprecated and removed" );
229	}
230
231	return jQXHR;
232};
233
234
235var oldRemoveAttr = jQuery.fn.removeAttr,
236	oldToggleClass = jQuery.fn.toggleClass,
237	rmatchNonSpace = /\S+/g;
238
239jQuery.fn.removeAttr = function( name ) {
240	var self = this;
241
242	jQuery.each( name.match( rmatchNonSpace ), function( i, attr ) {
243		if ( jQuery.expr.match.bool.test( attr ) ) {
244			migrateWarn( "jQuery.fn.removeAttr no longer sets boolean properties: " + attr );
245			self.prop( attr, false );
246		}
247	} );
248
249	return oldRemoveAttr.apply( this, arguments );
250};
251
252jQuery.fn.toggleClass = function( state ) {
253
254	// Only deprecating no-args or single boolean arg
255	if ( state !== undefined && typeof state !== "boolean" ) {
256		return oldToggleClass.apply( this, arguments );
257	}
258
259	migrateWarn( "jQuery.fn.toggleClass( boolean ) is deprecated" );
260
261	// Toggle entire class name of each element
262	return this.each( function() {
263		var className = this.getAttribute && this.getAttribute( "class" ) || "";
264
265		if ( className ) {
266			jQuery.data( this, "__className__", className );
267		}
268
269		// If the element has a class name or if we're passed `false`,
270		// then remove the whole classname (if there was one, the above saved it).
271		// Otherwise bring back whatever was previously saved (if anything),
272		// falling back to the empty string if nothing was stored.
273		if ( this.setAttribute ) {
274			this.setAttribute( "class",
275				className || state === false ?
276				"" :
277				jQuery.data( this, "__className__" ) || ""
278			);
279		}
280	} );
281};
282
283
284var internalSwapCall = false;
285
286// If this version of jQuery has .swap(), don't false-alarm on internal uses
287if ( jQuery.swap ) {
288	jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
289		var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
290
291		if ( oldHook ) {
292			jQuery.cssHooks[ name ].get = function() {
293				var ret;
294
295				internalSwapCall = true;
296				ret = oldHook.apply( this, arguments );
297				internalSwapCall = false;
298				return ret;
299			};
300		}
301	} );
302}
303
304jQuery.swap = function( elem, options, callback, args ) {
305	var ret, name,
306		old = {};
307
308	if ( !internalSwapCall ) {
309		migrateWarn( "jQuery.swap() is undocumented and deprecated" );
310	}
311
312	// Remember the old values, and insert the new ones
313	for ( name in options ) {
314		old[ name ] = elem.style[ name ];
315		elem.style[ name ] = options[ name ];
316	}
317
318	ret = callback.apply( elem, args || [] );
319
320	// Revert the old values
321	for ( name in options ) {
322		elem.style[ name ] = old[ name ];
323	}
324
325	return ret;
326};
327
328var oldData = jQuery.data;
329
330jQuery.data = function( elem, name, value ) {
331	var curData;
332
333	// Name can be an object, and each entry in the object is meant to be set as data
334	if ( name && typeof name === "object" && arguments.length === 2 ) {
335		curData = jQuery.hasData( elem ) && oldData.call( this, elem );
336		var sameKeys = {};
337		for ( var key in name ) {
338			if ( key !== jQuery.camelCase( key ) ) {
339				migrateWarn( "jQuery.data() always sets/gets camelCased names: " + key );
340				curData[ key ] = name[ key ];
341			} else {
342				sameKeys[ key ] = name[ key ];
343			}
344		}
345
346		oldData.call( this, elem, sameKeys );
347
348		return name;
349	}
350
351	// If the name is transformed, look for the un-transformed name in the data object
352	if ( name && typeof name === "string" && name !== jQuery.camelCase( name ) ) {
353		curData = jQuery.hasData( elem ) && oldData.call( this, elem );
354		if ( curData && name in curData ) {
355			migrateWarn( "jQuery.data() always sets/gets camelCased names: " + name );
356			if ( arguments.length > 2 ) {
357				curData[ name ] = value;
358			}
359			return curData[ name ];
360		}
361	}
362
363	return oldData.apply( this, arguments );
364};
365
366var oldTweenRun = jQuery.Tween.prototype.run;
367var linearEasing = function( pct ) {
368		return pct;
369	};
370
371jQuery.Tween.prototype.run = function( ) {
372	if ( jQuery.easing[ this.easing ].length > 1 ) {
373		migrateWarn(
374			"'jQuery.easing." + this.easing.toString() + "' should use only one argument"
375		);
376
377		jQuery.easing[ this.easing ] = linearEasing;
378	}
379
380	oldTweenRun.apply( this, arguments );
381};
382
383jQuery.fx.interval = jQuery.fx.interval || 13;
384
385// Support: IE9, Android <=4.4
386// Avoid false positives on browsers that lack rAF
387if ( window.requestAnimationFrame ) {
388	migrateWarnProp( jQuery.fx, "interval", jQuery.fx.interval,
389		"jQuery.fx.interval is deprecated" );
390}
391
392var oldLoad = jQuery.fn.load,
393	oldEventAdd = jQuery.event.add,
394	originalFix = jQuery.event.fix;
395
396jQuery.event.props = [];
397jQuery.event.fixHooks = {};
398
399migrateWarnProp( jQuery.event.props, "concat", jQuery.event.props.concat,
400	"jQuery.event.props.concat() is deprecated and removed" );
401
402jQuery.event.fix = function( originalEvent ) {
403	var event,
404		type = originalEvent.type,
405		fixHook = this.fixHooks[ type ],
406		props = jQuery.event.props;
407
408	if ( props.length ) {
409		migrateWarn( "jQuery.event.props are deprecated and removed: " + props.join() );
410		while ( props.length ) {
411			jQuery.event.addProp( props.pop() );
412		}
413	}
414
415	if ( fixHook && !fixHook._migrated_ ) {
416		fixHook._migrated_ = true;
417		migrateWarn( "jQuery.event.fixHooks are deprecated and removed: " + type );
418		if ( ( props = fixHook.props ) && props.length ) {
419			while ( props.length ) {
420				jQuery.event.addProp( props.pop() );
421			}
422		}
423	}
424
425	event = originalFix.call( this, originalEvent );
426
427	return fixHook && fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
428};
429
430jQuery.event.add = function( elem, types ) {
431
432	// This misses the multiple-types case but that seems awfully rare
433	if ( elem === window && types === "load" && window.document.readyState === "complete" ) {
434		migrateWarn( "jQuery(window).on('load'...) called after load event occurred" );
435	}
436	return oldEventAdd.apply( this, arguments );
437};
438
439jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
440
441	jQuery.fn[ name ] = function() {
442		var args = Array.prototype.slice.call( arguments, 0 );
443
444		// If this is an ajax load() the first arg should be the string URL;
445		// technically this could also be the "Anything" arg of the event .load()
446		// which just goes to show why this dumb signature has been deprecated!
447		// jQuery custom builds that exclude the Ajax module justifiably die here.
448		if ( name === "load" && typeof args[ 0 ] === "string" ) {
449			return oldLoad.apply( this, args );
450		}
451
452		migrateWarn( "jQuery.fn." + name + "() is deprecated" );
453
454		args.splice( 0, 0, name );
455		if ( arguments.length ) {
456			return this.on.apply( this, args );
457		}
458
459		// Use .triggerHandler here because:
460		// - load and unload events don't need to bubble, only applied to window or image
461		// - error event should not bubble to window, although it does pre-1.7
462		// See http://bugs.jquery.com/ticket/11820
463		this.triggerHandler.apply( this, args );
464		return this;
465	};
466
467} );
468
469jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
470	"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
471	"change select submit keydown keypress keyup contextmenu" ).split( " " ),
472	function( i, name ) {
473
474	// Handle event binding
475	jQuery.fn[ name ] = function( data, fn ) {
476		migrateWarn( "jQuery.fn." + name + "() event shorthand is deprecated" );
477		return arguments.length > 0 ?
478			this.on( name, null, data, fn ) :
479			this.trigger( name );
480	};
481} );
482
483// Trigger "ready" event only once, on document ready
484jQuery( function() {
485	jQuery( window.document ).triggerHandler( "ready" );
486} );
487
488jQuery.event.special.ready = {
489	setup: function() {
490		if ( this === window.document ) {
491			migrateWarn( "'ready' event is deprecated" );
492		}
493	}
494};
495
496jQuery.fn.extend( {
497
498	bind: function( types, data, fn ) {
499		migrateWarn( "jQuery.fn.bind() is deprecated" );
500		return this.on( types, null, data, fn );
501	},
502	unbind: function( types, fn ) {
503		migrateWarn( "jQuery.fn.unbind() is deprecated" );
504		return this.off( types, null, fn );
505	},
506	delegate: function( selector, types, data, fn ) {
507		migrateWarn( "jQuery.fn.delegate() is deprecated" );
508		return this.on( types, selector, data, fn );
509	},
510	undelegate: function( selector, types, fn ) {
511		migrateWarn( "jQuery.fn.undelegate() is deprecated" );
512		return arguments.length === 1 ?
513			this.off( selector, "**" ) :
514			this.off( types, selector || "**", fn );
515	},
516	hover: function( fnOver, fnOut ) {
517		migrateWarn( "jQuery.fn.hover() is deprecated" );
518		return this.on( "mouseenter", fnOver ).on( "mouseleave", fnOut || fnOver );
519	}
520} );
521
522
523var oldOffset = jQuery.fn.offset;
524
525jQuery.fn.offset = function() {
526	var docElem,
527		elem = this[ 0 ],
528		origin = { top: 0, left: 0 };
529
530	if ( !elem || !elem.nodeType ) {
531		migrateWarn( "jQuery.fn.offset() requires a valid DOM element" );
532		return origin;
533	}
534
535	docElem = ( elem.ownerDocument || window.document ).documentElement;
536	if ( !jQuery.contains( docElem, elem ) ) {
537		migrateWarn( "jQuery.fn.offset() requires an element connected to a document" );
538		return origin;
539	}
540
541	return oldOffset.apply( this, arguments );
542};
543
544
545var oldParam = jQuery.param;
546
547jQuery.param = function( data, traditional ) {
548	var ajaxTraditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
549
550	if ( traditional === undefined && ajaxTraditional ) {
551
552		migrateWarn( "jQuery.param() no longer uses jQuery.ajaxSettings.traditional" );
553		traditional = ajaxTraditional;
554	}
555
556	return oldParam.call( this, data, traditional );
557};
558
559var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
560
561jQuery.fn.andSelf = function() {
562	migrateWarn( "jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()" );
563	return oldSelf.apply( this, arguments );
564};
565
566
567var oldDeferred = jQuery.Deferred,
568	tuples = [
569
570		// Action, add listener, callbacks, .then handlers, final state
571		[ "resolve", "done", jQuery.Callbacks( "once memory" ),
572			jQuery.Callbacks( "once memory" ), "resolved" ],
573		[ "reject", "fail", jQuery.Callbacks( "once memory" ),
574			jQuery.Callbacks( "once memory" ), "rejected" ],
575		[ "notify", "progress", jQuery.Callbacks( "memory" ),
576			jQuery.Callbacks( "memory" ) ]
577	];
578
579jQuery.Deferred = function( func ) {
580	var deferred = oldDeferred(),
581		promise = deferred.promise();
582
583	deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) {
584		var fns = arguments;
585
586		migrateWarn( "deferred.pipe() is deprecated" );
587
588		return jQuery.Deferred( function( newDefer ) {
589			jQuery.each( tuples, function( i, tuple ) {
590				var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
591
592				// Deferred.done(function() { bind to newDefer or newDefer.resolve })
593				// deferred.fail(function() { bind to newDefer or newDefer.reject })
594				// deferred.progress(function() { bind to newDefer or newDefer.notify })
595				deferred[ tuple[ 1 ] ]( function() {
596					var returned = fn && fn.apply( this, arguments );
597					if ( returned && jQuery.isFunction( returned.promise ) ) {
598						returned.promise()
599							.done( newDefer.resolve )
600							.fail( newDefer.reject )
601							.progress( newDefer.notify );
602					} else {
603						newDefer[ tuple[ 0 ] + "With" ](
604							this === promise ? newDefer.promise() : this,
605							fn ? [ returned ] : arguments
606						);
607					}
608				} );
609			} );
610			fns = null;
611		} ).promise();
612
613	};
614
615	if ( func ) {
616		func.call( deferred, deferred );
617	}
618
619	return deferred;
620};
621
622// Preserve handler of uncaught exceptions in promise chains
623jQuery.Deferred.exceptionHook = oldDeferred.exceptionHook;
624
625return jQuery;
626} );

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.