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