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