PageSourceSearch

https://alter-vienne.info/prive/javascript/jquery-migrate-3.0.1.js?1616011684

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

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.