PageSourceSearch

https://americanambulance.com/Resources/libraries/jQuery-Migrate/03_00_00/jquery-migrate.js?cdv=158

js americanambulance.com collected 2026-09-29 23:28:02 UTC 15,491 bytes, 541 lines download raw bytes

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

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.