[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/jquery/ -> jquery-migrate.js (source)

   1  /*!
   2   * jQuery Migrate - v3.6.0 - 2025-12-11T02:48Z
   3   * Copyright OpenJS Foundation and other contributors
   4   * Released under the MIT license
   5   * https://jquery.com/license/
   6   */
   7  ( function( factory ) {
   8      "use strict";
   9  
  10      if ( typeof define === "function" && define.amd ) {
  11  
  12          // AMD. Register as an anonymous module.
  13          define( [ "jquery" ], function( jQuery ) {
  14              return factory( jQuery, window );
  15          } );
  16      } else if ( typeof module === "object" && module.exports ) {
  17  
  18          // Node/CommonJS
  19          // eslint-disable-next-line no-undef
  20          module.exports = factory( require( "jquery" ), window );
  21      } else {
  22  
  23          // Browser globals
  24          factory( jQuery, window );
  25      }
  26  } )( function( jQuery, window ) {
  27  "use strict";
  28  
  29  jQuery.migrateVersion = "3.6.0";
  30  
  31  // Returns 0 if v1 == v2, -1 if v1 < v2, 1 if v1 > v2
  32  function compareVersions( v1, v2 ) {
  33      var i,
  34          rVersionParts = /^(\d+)\.(\d+)\.(\d+)/,
  35          v1p = rVersionParts.exec( v1 ) || [ ],
  36          v2p = rVersionParts.exec( v2 ) || [ ];
  37  
  38      for ( i = 1; i <= 3; i++ ) {
  39          if ( +v1p[ i ] > +v2p[ i ] ) {
  40              return 1;
  41          }
  42          if ( +v1p[ i ] < +v2p[ i ] ) {
  43              return -1;
  44          }
  45      }
  46      return 0;
  47  }
  48  
  49  function jQueryVersionSince( version ) {
  50      return compareVersions( jQuery.fn.jquery, version ) >= 0;
  51  }
  52  
  53  // A map from disabled patch codes to `true`. This should really
  54  // be a `Set` but those are unsupported in IE.
  55  var disabledPatches = Object.create( null );
  56  
  57  // Don't apply patches for specified codes. Helpful for code bases
  58  // where some Migrate warnings have been addressed, and it's desirable
  59  // to avoid needless patches or false positives.
  60  jQuery.migrateDisablePatches = function() {
  61      var i;
  62      for ( i = 0; i < arguments.length; i++ ) {
  63          disabledPatches[ arguments[ i ] ] = true;
  64      }
  65  };
  66  
  67  // Allow enabling patches disabled via `jQuery.migrateDisablePatches`.
  68  // Helpful if you want to disable a patch only for some code that won't
  69  // be updated soon to be able to focus on other warnings - and enable it
  70  // immediately after such a call:
  71  // ```js
  72  // jQuery.migrateDisablePatches( "workaroundA" );
  73  // elem.pluginViolatingWarningA( "pluginMethod" );
  74  // jQuery.migrateEnablePatches( "workaroundA" );
  75  // ```
  76  jQuery.migrateEnablePatches = function() {
  77      var i;
  78      for ( i = 0; i < arguments.length; i++ ) {
  79          delete disabledPatches[ arguments[ i ] ];
  80      }
  81  };
  82  
  83  jQuery.migrateIsPatchEnabled = function( patchCode ) {
  84      return !disabledPatches[ patchCode ];
  85  };
  86  
  87  ( function() {
  88  
  89  // Support: IE9 only
  90  // IE9 only creates console object when dev tools are first opened
  91  // IE9 console is a host object, callable but doesn't have .apply()
  92  if ( !window.console || !window.console.log ) {
  93      return;
  94  }
  95  
  96  // Need jQuery 3.x and no older Migrate loaded
  97  if ( !jQuery || !jQueryVersionSince( "3.0.0" ) ||
  98          jQueryVersionSince( "4.0.0" ) ) {
  99      window.console.log( "JQMIGRATE: jQuery 3.x REQUIRED" );
 100  }
 101  if ( jQuery.migrateWarnings ) {
 102      window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" );
 103  }
 104  
 105  // Show a message on the console so devs know we're active
 106  window.console.log( "JQMIGRATE: Migrate is installed" +
 107      ( jQuery.migrateMute ? "" : " with logging active" ) +
 108      ", version " + jQuery.migrateVersion );
 109  
 110  } )();
 111  
 112  var warnedAbout = {};
 113  
 114  // By default, each warning is only reported once.
 115  jQuery.migrateDeduplicateWarnings = true;
 116  
 117  // List of warnings already given; public read only
 118  jQuery.migrateWarnings = [];
 119  
 120  // Set to `false` to disable traces that appear with warnings
 121  if ( jQuery.migrateTrace === undefined ) {
 122      jQuery.migrateTrace = true;
 123  }
 124  
 125  // Forget any warnings we've already given; public
 126  jQuery.migrateReset = function() {
 127      warnedAbout = {};
 128      jQuery.migrateWarnings.length = 0;
 129  };
 130  
 131  function migrateWarn( code, msg ) {
 132      var console = window.console;
 133      if ( jQuery.migrateIsPatchEnabled( code ) &&
 134          ( !jQuery.migrateDeduplicateWarnings || !warnedAbout[ msg ] ) ) {
 135          warnedAbout[ msg ] = true;
 136          jQuery.migrateWarnings.push( msg + " [" + code + "]" );
 137          if ( console && console.warn && !jQuery.migrateMute ) {
 138              console.warn( "JQMIGRATE: " + msg );
 139              if ( jQuery.migrateTrace && console.trace ) {
 140                  console.trace();
 141              }
 142          }
 143      }
 144  }
 145  
 146  function migrateWarnProp( obj, prop, value, code, msg ) {
 147      Object.defineProperty( obj, prop, {
 148          configurable: true,
 149          enumerable: true,
 150          get: function() {
 151              migrateWarn( code, msg );
 152              return value;
 153          },
 154          set: function( newValue ) {
 155              migrateWarn( code, msg );
 156              value = newValue;
 157          }
 158      } );
 159  }
 160  
 161  function migrateWarnFuncInternal( obj, prop, newFunc, code, msg ) {
 162      var finalFunc,
 163          origFunc = obj[ prop ];
 164  
 165      obj[ prop ] = function() {
 166  
 167          // If `msg` not provided, do not warn; more sophisticated warnings
 168          // logic is most likely embedded in `newFunc`, in that case here
 169          // we just care about the logic choosing the proper implementation
 170          // based on whether the patch is disabled or not.
 171          if ( msg ) {
 172              migrateWarn( code, msg );
 173          }
 174  
 175          // Since patches can be disabled & enabled dynamically, we
 176          // need to decide which implementation to run on each invocation.
 177          finalFunc = jQuery.migrateIsPatchEnabled( code ) ?
 178              newFunc :
 179  
 180              // The function may not have existed originally so we need a fallback.
 181              ( origFunc || jQuery.noop );
 182  
 183          return finalFunc.apply( this, arguments );
 184      };
 185  }
 186  
 187  function migratePatchAndWarnFunc( obj, prop, newFunc, code, msg ) {
 188      if ( !msg ) {
 189          throw new Error( "No warning message provided" );
 190      }
 191      return migrateWarnFuncInternal( obj, prop, newFunc, code, msg );
 192  }
 193  
 194  function migratePatchFunc( obj, prop, newFunc, code ) {
 195      return migrateWarnFuncInternal( obj, prop, newFunc, code );
 196  }
 197  
 198  if ( window.document.compatMode === "BackCompat" ) {
 199  
 200      // jQuery has never supported or tested Quirks Mode
 201      migrateWarn( "quirks", "jQuery is not compatible with Quirks Mode" );
 202  }
 203  
 204  var arr = [],
 205      push = arr.push,
 206      sort = arr.sort,
 207      splice = arr.splice,
 208      class2type = {},
 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  
 214  function isFunction( obj ) {
 215  
 216      // Support: Chrome <=57, Firefox <=52
 217      // In some browsers, typeof returns "function" for HTML <object> elements
 218      // (i.e., `typeof document.createElement( "object" ) === "function"`).
 219      // We don't want to classify *any* DOM node as a function.
 220      // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5
 221      // Plus for old WebKit, typeof returns "function" for HTML collections
 222      // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756)
 223      return typeof obj === "function" && typeof obj.nodeType !== "number" &&
 224          typeof obj.item !== "function";
 225  }
 226  
 227  // The number of elements contained in the matched element set
 228  migratePatchAndWarnFunc( jQuery.fn, "size", function() {
 229      return this.length;
 230  }, "size",
 231  "jQuery.fn.size() is deprecated and removed; use the .length property" );
 232  
 233  migratePatchAndWarnFunc( jQuery, "parseJSON", function() {
 234      return JSON.parse.apply( null, arguments );
 235  }, "parseJSON",
 236  "jQuery.parseJSON is deprecated; use JSON.parse" );
 237  
 238  migratePatchAndWarnFunc( jQuery, "holdReady", jQuery.holdReady,
 239      "holdReady", "jQuery.holdReady is deprecated" );
 240  
 241  migratePatchAndWarnFunc( jQuery, "unique", jQuery.uniqueSort,
 242      "unique", "jQuery.unique is deprecated; use jQuery.uniqueSort" );
 243  
 244  // Prior to jQuery 3.1.1 there were internal refs so we don't warn there
 245  if ( jQueryVersionSince( "3.1.1" ) ) {
 246      migratePatchAndWarnFunc( jQuery, "trim", function( text ) {
 247          return text == null ?
 248              "" :
 249              ( text + "" ).replace( rtrim, "$1" );
 250      }, "trim",
 251      "jQuery.trim is deprecated; use String.prototype.trim" );
 252  }
 253  
 254  // Prior to jQuery 3.2 there were internal refs so we don't warn there
 255  if ( jQueryVersionSince( "3.2.0" ) ) {
 256      migratePatchAndWarnFunc( jQuery, "nodeName", function( elem, name ) {
 257          return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
 258      }, "nodeName",
 259      "jQuery.nodeName is deprecated" );
 260  
 261      migratePatchAndWarnFunc( jQuery, "isArray", Array.isArray, "isArray",
 262          "jQuery.isArray is deprecated; use Array.isArray"
 263      );
 264  }
 265  
 266  if ( jQueryVersionSince( "3.3.0" ) ) {
 267  
 268      migratePatchAndWarnFunc( jQuery, "isNumeric",
 269          function( obj ) {
 270  
 271              // As of jQuery 3.0, isNumeric is limited to
 272              // strings and numbers (primitives or objects)
 273              // that can be coerced to finite numbers (gh-2662)
 274              var type = typeof obj;
 275              return ( type === "number" || type === "string" ) &&
 276  
 277                  // parseFloat NaNs numeric-cast false positives ("")
 278                  // ...but misinterprets leading-number strings, e.g. hex literals ("0x...")
 279                  // subtraction forces infinities to NaN
 280                  !isNaN( obj - parseFloat( obj ) );
 281          }, "isNumeric",
 282          "jQuery.isNumeric() is deprecated"
 283      );
 284  
 285      // Populate the class2type map
 286      jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".
 287          split( " " ),
 288      function( _, name ) {
 289          class2type[ "[object " + name + "]" ] = name.toLowerCase();
 290      } );
 291  
 292      migratePatchAndWarnFunc( jQuery, "type", function( obj ) {
 293          if ( obj == null ) {
 294              return obj + "";
 295          }
 296  
 297          // Support: Android <=2.3 only (functionish RegExp)
 298          return typeof obj === "object" || typeof obj === "function" ?
 299              class2type[ Object.prototype.toString.call( obj ) ] || "object" :
 300              typeof obj;
 301      }, "type",
 302      "jQuery.type is deprecated" );
 303  
 304      migratePatchAndWarnFunc( jQuery, "isFunction", function( obj ) {
 305          return isFunction( obj );
 306      }, "isFunction",
 307      "jQuery.isFunction() is deprecated" );
 308  
 309      migratePatchAndWarnFunc( jQuery, "isWindow",
 310          function( obj ) {
 311              return obj != null && obj === obj.window;
 312          }, "isWindow",
 313          "jQuery.isWindow() is deprecated"
 314      );
 315  
 316      migratePatchAndWarnFunc( jQuery, "now", Date.now, "now",
 317          "jQuery.now() is deprecated; use Date.now()"
 318      );
 319  
 320      migratePatchAndWarnFunc( jQuery, "camelCase", jQuery.camelCase, "camelCase",
 321          "jQuery.camelCase() is deprecated"
 322      );
 323  
 324      // Bind a function to a context, optionally partially applying any
 325      // arguments.
 326      // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
 327      // However, it is not slated for removal any time soon
 328      migratePatchAndWarnFunc( jQuery, "proxy", jQuery.proxy,
 329          "proxy", "DEPRECATED: jQuery.proxy()" );
 330  
 331  }
 332  
 333  if ( jQueryVersionSince( "3.7.0" ) ) {
 334      migratePatchAndWarnFunc( jQuery.fn, "push", push, "push",
 335          "jQuery.fn.push() is deprecated; use .add() or convert to an array" );
 336      migratePatchAndWarnFunc( jQuery.fn, "sort", sort, "sort",
 337          "jQuery.fn.sort() is deprecated; convert to an array before sorting" );
 338      migratePatchAndWarnFunc( jQuery.fn, "splice", splice, "splice",
 339          "jQuery.fn.splice() is deprecated; use .slice() or .not() with .eq()" );
 340  }
 341  
 342  var findProp,
 343      oldInit = jQuery.fn.init,
 344      oldFind = jQuery.find,
 345  
 346      rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,
 347      rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g;
 348  
 349  migratePatchFunc( jQuery.fn, "init", function( arg1 ) {
 350      var args = Array.prototype.slice.call( arguments );
 351  
 352      if ( jQuery.migrateIsPatchEnabled( "selector-empty-id" ) &&
 353          typeof arg1 === "string" && arg1 === "#" ) {
 354  
 355          // JQuery( "#" ) is a bogus ID selector, but it returned an empty set
 356          // before jQuery 3.0
 357          migrateWarn( "selector-empty-id", "jQuery( '#' ) is not a valid selector" );
 358          args[ 0 ] = [];
 359      }
 360  
 361      return oldInit.apply( this, args );
 362  }, "selector-empty-id" );
 363  
 364  // This is already done in Core but the above patch will lose this assignment
 365  // so we need to redo it. It doesn't matter whether the patch is enabled or not
 366  // as the method is always going to be a Migrate-created wrapper.
 367  jQuery.fn.init.prototype = jQuery.fn;
 368  
 369  migratePatchFunc( jQuery, "find", function( selector ) {
 370      var args = Array.prototype.slice.call( arguments );
 371  
 372      // Support: PhantomJS 1.x
 373      // String#match fails to match when used with a //g RegExp, only on some strings
 374      if ( typeof selector === "string" && rattrHashTest.test( selector ) ) {
 375  
 376          // The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
 377          // First see if qS thinks it's a valid selector, if so avoid a false positive
 378          try {
 379              window.document.querySelector( selector );
 380          } catch ( err1 ) {
 381  
 382              // Didn't *look* valid to qSA, warn and try quoting what we think is the value
 383              selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) {
 384                  return "[" + attr + op + "\"" + value + "\"]";
 385              } );
 386  
 387              // If the regexp *may* have created an invalid selector, don't update it
 388              // Note that there may be false alarms if selector uses jQuery extensions
 389              try {
 390                  window.document.querySelector( selector );
 391                  migrateWarn( "selector-hash",
 392                      "Attribute selector with '#' must be quoted: " + args[ 0 ] );
 393                  args[ 0 ] = selector;
 394              } catch ( err2 ) {
 395                  migrateWarn( "selector-hash",
 396                      "Attribute selector with '#' was not fixed: " + args[ 0 ] );
 397              }
 398          }
 399      }
 400  
 401      return oldFind.apply( this, args );
 402  }, "selector-hash" );
 403  
 404  // Copy properties attached to original jQuery.find method (e.g. .attr, .isXML)
 405  for ( findProp in oldFind ) {
 406      if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) {
 407          jQuery.find[ findProp ] = oldFind[ findProp ];
 408      }
 409  }
 410  
 411  // Now jQuery.expr.pseudos is the standard incantation
 412  migrateWarnProp( jQuery.expr, "filters", jQuery.expr.pseudos, "expr-pre-pseudos",
 413      "jQuery.expr.filters is deprecated; use jQuery.expr.pseudos" );
 414  migrateWarnProp( jQuery.expr, ":", jQuery.expr.pseudos, "expr-pre-pseudos",
 415      "jQuery.expr[':'] is deprecated; use jQuery.expr.pseudos" );
 416  
 417  function markFunction( fn ) {
 418      fn[ jQuery.expando ] = true;
 419      return fn;
 420  }
 421  
 422  // jQuery older than 3.7.0 used Sizzle which has its own private expando
 423  // variable that we cannot access. This makes thi patch impossible in those
 424  // jQuery versions.
 425  if ( jQueryVersionSince( "3.7.0" ) ) {
 426      migratePatchFunc( jQuery.expr.filter, "PSEUDO", function( pseudo, argument ) {
 427  
 428          // pseudo-class names are case-insensitive
 429          // https://www.w3.org/TR/selectors/#pseudo-classes
 430          // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
 431          // Remember that setFilters inherits from pseudos
 432          var args,
 433              fn = jQuery.expr.pseudos[ pseudo ] ||
 434                  jQuery.expr.setFilters[ pseudo.toLowerCase() ] ||
 435                  jQuery.error(
 436                      "Syntax error, unrecognized expression: unsupported pseudo: " +
 437                          pseudo );
 438  
 439          // The user may use createPseudo to indicate that
 440          // arguments are needed to create the filter function
 441          // just as jQuery does
 442          if ( fn[ jQuery.expando ] ) {
 443              return fn( argument );
 444          }
 445  
 446          // But maintain support for old signatures
 447          if ( fn.length > 1 ) {
 448              migrateWarn( "legacy-custom-pseudos",
 449                  "Pseudos with multiple arguments are deprecated; " +
 450                      "use jQuery.expr.createPseudo()" );
 451              args = [ pseudo, pseudo, "", argument ];
 452              return jQuery.expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
 453                  markFunction( function( seed, matches ) {
 454                      var idx,
 455                          matched = fn( seed, argument ),
 456                          i = matched.length;
 457                      while ( i-- ) {
 458                          idx = Array.prototype.indexOf.call( seed, matched[ i ] );
 459                          seed[ idx ] = !( matches[ idx ] = matched[ i ] );
 460                      }
 461                  } ) :
 462                  function( elem ) {
 463                      return fn( elem, 0, args );
 464                  };
 465          }
 466  
 467          return fn;
 468      }, "legacy-custom-pseudos" );
 469  
 470      if ( typeof Proxy !== "undefined" ) {
 471          jQuery.each( [ "pseudos", "setFilters" ], function( _, api ) {
 472              jQuery.expr[ api ] = new Proxy( jQuery.expr[ api ], {
 473                  set: function( _target, _prop, fn ) {
 474                      if ( typeof fn === "function" && !fn[ jQuery.expando ] && fn.length > 1 ) {
 475                          migrateWarn( "legacy-custom-pseudos",
 476                              "Pseudos with multiple arguments are deprecated; " +
 477                                  "use jQuery.expr.createPseudo()" );
 478                      }
 479                      return Reflect.set.apply( this, arguments );
 480                  }
 481              } );
 482          } );
 483      }
 484  }
 485  
 486  // Support jQuery slim which excludes the ajax module
 487  if ( jQuery.ajax ) {
 488  
 489  var oldAjax = jQuery.ajax,
 490      oldCallbacks = [],
 491      guid = "migrate-" + Date.now(),
 492      origJsonpCallback = jQuery.ajaxSettings.jsonpCallback,
 493      rjsonp = /(=)\?(?=&|$)|\?\?/;
 494  
 495  migratePatchFunc( jQuery, "ajax", function() {
 496      var jQXHR = oldAjax.apply( this, arguments );
 497  
 498      // Be sure we got a jQXHR (e.g., not sync)
 499      if ( jQXHR.promise ) {
 500          migratePatchAndWarnFunc( jQXHR, "success", jQXHR.done, "jqXHR-methods",
 501              "jQXHR.success is deprecated and removed" );
 502          migratePatchAndWarnFunc( jQXHR, "error", jQXHR.fail, "jqXHR-methods",
 503              "jQXHR.error is deprecated and removed" );
 504          migratePatchAndWarnFunc( jQXHR, "complete", jQXHR.always, "jqXHR-methods",
 505              "jQXHR.complete is deprecated and removed" );
 506      }
 507  
 508      return jQXHR;
 509  }, "jqXHR-methods" );
 510  
 511  jQuery.ajaxSetup( {
 512      jsonpCallback: function() {
 513  
 514          // Source is virtually the same as in Core, but we need to duplicate
 515          // to maintain a proper `oldCallbacks` reference.
 516          if ( jQuery.migrateIsPatchEnabled( "jsonp-promotion" ) ) {
 517              var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( guid++ ) );
 518              this[ callback ] = true;
 519              return callback;
 520          } else {
 521              return origJsonpCallback.apply( this, arguments );
 522          }
 523      }
 524  } );
 525  
 526  // Register this prefilter before the jQuery one. Otherwise, a promoted
 527  // request is transformed into one with the script dataType, and we can't
 528  // catch it anymore.
 529  // jQuery <4 already contains this prefilter; don't duplicate the whole logic,
 530  // but only enough to know when to warn.
 531  jQuery.ajaxPrefilter( "+json", function( s ) {
 532  
 533      if ( !jQuery.migrateIsPatchEnabled( "jsonp-promotion" ) ) {
 534          return;
 535      }
 536  
 537      // Warn if JSON-to-JSONP auto-promotion happens.
 538      if ( s.jsonp !== false && ( rjsonp.test( s.url ) ||
 539              typeof s.data === "string" &&
 540              ( s.contentType || "" )
 541                  .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
 542              rjsonp.test( s.data )
 543      ) ) {
 544          migrateWarn( "jsonp-promotion", "JSON-to-JSONP auto-promotion is deprecated" );
 545      }
 546  } );
 547  
 548  }
 549  
 550  var oldRemoveAttr = jQuery.fn.removeAttr,
 551      oldJQueryAttr = jQuery.attr,
 552      oldToggleClass = jQuery.fn.toggleClass,
 553      booleans = "checked|selected|async|autofocus|autoplay|controls|defer|" +
 554          "disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
 555      rbooleans = new RegExp( "^(?:" + booleans + ")$", "i" ),
 556      rmatchNonSpace = /\S+/g,
 557  
 558      // Some formerly boolean attributes gained new values with special meaning.
 559      // Skip the old boolean attr logic for those values.
 560      extraBoolAttrValues = {
 561          hidden: [ "until-found" ]
 562      };
 563  
 564  // HTML boolean attributes have special behavior:
 565  // we consider the lowercase name to be the only valid value, so
 566  // getting (if the attribute is present) normalizes to that, as does
 567  // setting to any non-`false` value (and setting to `false` removes the attribute).
 568  // See https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes
 569  jQuery.each( booleans.split( "|" ), function( _i, name ) {
 570      var origAttrHooks = jQuery.attrHooks[ name ] || {};
 571      jQuery.attrHooks[ name ] = {
 572          get: origAttrHooks.get || function( elem ) {
 573              var attrValue;
 574  
 575              if ( jQuery.migrateIsPatchEnabled( "boolean-attributes" ) ) {
 576                  attrValue = elem.getAttribute( name );
 577  
 578                  if ( attrValue !== name && attrValue != null &&
 579                      ( extraBoolAttrValues[ name ] || [] )
 580                          .indexOf( String( attrValue ).toLowerCase() ) === -1
 581                  ) {
 582                      migrateWarn( "boolean-attributes",
 583                          "Boolean attribute '" + name +
 584                              "' value is different from its lowercased name" );
 585                  }
 586              }
 587  
 588              return null;
 589          },
 590  
 591          set: origAttrHooks.set || function( elem, value, name ) {
 592              if ( jQuery.migrateIsPatchEnabled( "boolean-attributes" ) ) {
 593                  if ( value !== name &&
 594                      ( extraBoolAttrValues[ name ] || [] )
 595                          .indexOf( String( value ).toLowerCase() ) === -1
 596                  ) {
 597                      if ( value !== false ) {
 598                          migrateWarn( "boolean-attributes",
 599                              "Boolean attribute '" + name +
 600                                  "' is not set to its lowercased name" );
 601                      }
 602  
 603                      if ( value === false ) {
 604  
 605                          // Remove boolean attributes when set to false
 606                          jQuery.removeAttr( elem, name );
 607                      } else {
 608                          elem.setAttribute( name, name );
 609                      }
 610                      return name;
 611                  }
 612              } else {
 613  
 614                  // jQuery <4 uses a private `boolHook` for the boolean attribute
 615                  // setter. It's only activated if `attrHook` is not set, but we set
 616                  // it here in Migrate so jQuery would not use it. Since we cannot
 617                  // access it, let's just repeat its contents here.
 618                  if ( value === false ) {
 619  
 620                      // Remove boolean attributes when set to false
 621                      jQuery.removeAttr( elem, name );
 622                  } else {
 623                      elem.setAttribute( name, name );
 624                  }
 625                  return name;
 626              }
 627          }
 628      };
 629  } );
 630  
 631  migratePatchFunc( jQuery, "attr", function( elem, name, value ) {
 632      var nType = elem.nodeType;
 633  
 634      // Fallback to the original method on text, comment and attribute nodes
 635      // and when attributes are not supported.
 636      if ( nType === 3 || nType === 8 || nType === 2 ||
 637              typeof elem.getAttribute === "undefined" ) {
 638          return oldJQueryAttr.apply( this, arguments );
 639      }
 640  
 641      if ( value === false && name.toLowerCase().indexOf( "aria-" ) !== 0 &&
 642              !rbooleans.test( name ) ) {
 643          migrateWarn( "attr-false",
 644              "Setting the non-ARIA non-boolean attribute '" + name +
 645                  "' to false" );
 646  
 647          jQuery.attr( elem, name, "false" );
 648          return;
 649      }
 650  
 651      return oldJQueryAttr.apply( this, arguments );
 652  }, "attr-false" );
 653  
 654  migratePatchFunc( jQuery.fn, "removeAttr", function( name ) {
 655      var self = this,
 656          patchNeeded = false;
 657  
 658      jQuery.each( name.match( rmatchNonSpace ), function( _i, attr ) {
 659          if ( rbooleans.test( attr ) ) {
 660  
 661              // Only warn if at least a single node had the property set to
 662              // something else than `false`. Otherwise, this Migrate patch
 663              // doesn't influence the behavior and there's no need to set or warn.
 664              self.each( function() {
 665                  if ( jQuery( this ).prop( attr ) !== false ) {
 666                      patchNeeded = true;
 667                      return false;
 668                  }
 669              } );
 670          }
 671  
 672          if ( patchNeeded ) {
 673              migrateWarn( "removeAttr-bool",
 674                  "jQuery.fn.removeAttr no longer sets boolean properties: " + attr );
 675              self.prop( attr, false );
 676          }
 677      } );
 678  
 679      return oldRemoveAttr.apply( this, arguments );
 680  }, "removeAttr-bool" );
 681  
 682  migratePatchFunc( jQuery.fn, "toggleClass", function( state ) {
 683  
 684      // Only deprecating no-args or single boolean arg
 685      if ( state !== undefined && typeof state !== "boolean" ) {
 686  
 687          return oldToggleClass.apply( this, arguments );
 688      }
 689  
 690      migrateWarn( "toggleClass-bool", "jQuery.fn.toggleClass( boolean ) is deprecated" );
 691  
 692      // Toggle entire class name of each element
 693      return this.each( function() {
 694          var className = this.getAttribute && this.getAttribute( "class" ) || "";
 695  
 696          if ( className ) {
 697              jQuery.data( this, "__className__", className );
 698          }
 699  
 700          // If the element has a class name or if we're passed `false`,
 701          // then remove the whole classname (if there was one, the above saved it).
 702          // Otherwise, bring back whatever was previously saved (if anything),
 703          // falling back to the empty string if nothing was stored.
 704          if ( this.setAttribute ) {
 705              this.setAttribute( "class",
 706                  className || state === false ?
 707                      "" :
 708                      jQuery.data( this, "__className__" ) || ""
 709              );
 710          }
 711      } );
 712  }, "toggleClass-bool" );
 713  
 714  function camelCase( string ) {
 715      return string.replace( /-([a-z])/g, function( _, letter ) {
 716          return letter.toUpperCase();
 717      } );
 718  }
 719  
 720  // Make `object` inherit from `Object.prototype` via an additional object
 721  // in between; that intermediate object proxies properties
 722  // to `Object.prototype`, warning about their usage first.
 723  function patchProto( object, options ) {
 724  
 725      // Support: IE 9 - 10 only, iOS 7 - 8 only
 726      // Older IE doesn't have a way to change an existing prototype.
 727      // Just return the original method there.
 728      // Older WebKit supports `__proto__` but not `Object.setPrototypeOf`.
 729      // To avoid complicating code, don't patch the API there either.
 730      if ( !Object.setPrototypeOf ) {
 731          return object;
 732      }
 733  
 734      var i,
 735          warningId = options.warningId,
 736          apiName = options.apiName,
 737  
 738          // `Object.prototype` keys are not enumerable so list the
 739          // official ones here. An alternative would be wrapping
 740          // objects with a Proxy but that creates additional issues
 741          // like breaking object identity on subsequent calls.
 742          objProtoKeys = [
 743              "__proto__",
 744              "__defineGetter__",
 745              "__defineSetter__",
 746              "__lookupGetter__",
 747              "__lookupSetter__",
 748              "hasOwnProperty",
 749              "isPrototypeOf",
 750              "propertyIsEnumerable",
 751              "toLocaleString",
 752              "toString",
 753              "valueOf"
 754          ],
 755  
 756          // Use a null prototype at the beginning so that we can define our
 757          // `__proto__` getter & setter. We'll reset the prototype afterward.
 758          intermediateObj = Object.create( null );
 759  
 760      for ( i = 0; i < objProtoKeys.length; i++ ) {
 761          ( function( key ) {
 762              Object.defineProperty( intermediateObj, key, {
 763                  get: function() {
 764                      migrateWarn( warningId,
 765                          "Accessing properties from " + apiName +
 766                          " inherited from Object.prototype is deprecated" );
 767                      return ( key + "__cache" ) in intermediateObj ?
 768                          intermediateObj[ key + "__cache" ] :
 769                          Object.prototype[ key ];
 770                  },
 771                  set: function( value ) {
 772                      migrateWarn( warningId,
 773                          "Setting properties from " + apiName +
 774                          " inherited from Object.prototype is deprecated" );
 775                      intermediateObj[ key + "__cache" ] = value;
 776                  }
 777              } );
 778          } )( objProtoKeys[ i ] );
 779      }
 780  
 781      Object.setPrototypeOf( intermediateObj, Object.prototype );
 782      Object.setPrototypeOf( object, intermediateObj );
 783  
 784      return object;
 785  }
 786  
 787  var origFnCss,
 788      internalSwapCall = false,
 789      ralphaStart = /^[a-z]/,
 790  
 791      // The regex visualized:
 792      //
 793      //                         /----------\
 794      //                        |            |    /-------\
 795      //                        |  / Top  \  |   |         |
 796      //         /--- Border ---+-| Right  |-+---+- Width -+---\
 797      //        |                 | Bottom |                    |
 798      //        |                  \ Left /                     |
 799      //        |                                               |
 800      //        |                              /----------\     |
 801      //        |          /-------------\    |            |    |- END
 802      //        |         |               |   |  / Top  \  |    |
 803      //        |         |  / Margin  \  |   | | Right  | |    |
 804      //        |---------+-|           |-+---+-| Bottom |-+----|
 805      //        |            \ Padding /         \ Left /       |
 806      // BEGIN -|                                               |
 807      //        |                /---------\                    |
 808      //        |               |           |                   |
 809      //        |               |  / Min \  |    / Width  \     |
 810      //         \--------------+-|       |-+---|          |---/
 811      //                           \ Max /       \ Height /
 812      rautoPx = /^(?:Border(?:Top|Right|Bottom|Left)?(?:Width|)|(?:Margin|Padding)?(?:Top|Right|Bottom|Left)?|(?:Min|Max)?(?:Width|Height))$/;
 813  
 814  // If this version of jQuery has .swap(), don't false-alarm on internal uses
 815  if ( jQuery.swap ) {
 816      jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
 817          var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
 818  
 819          if ( oldHook ) {
 820              jQuery.cssHooks[ name ].get = function() {
 821                  var ret;
 822  
 823                  internalSwapCall = true;
 824                  ret = oldHook.apply( this, arguments );
 825                  internalSwapCall = false;
 826                  return ret;
 827              };
 828          }
 829      } );
 830  }
 831  
 832  migratePatchFunc( jQuery, "swap", function( elem, options, callback, args ) {
 833      var ret, name,
 834          old = {};
 835  
 836      if ( !internalSwapCall ) {
 837          migrateWarn( "swap", "jQuery.swap() is undocumented and deprecated" );
 838      }
 839  
 840      // Remember the old values, and insert the new ones
 841      for ( name in options ) {
 842          old[ name ] = elem.style[ name ];
 843          elem.style[ name ] = options[ name ];
 844      }
 845  
 846      ret = callback.apply( elem, args || [] );
 847  
 848      // Revert the old values
 849      for ( name in options ) {
 850          elem.style[ name ] = old[ name ];
 851      }
 852  
 853      return ret;
 854  }, "swap" );
 855  
 856  if ( jQueryVersionSince( "3.4.0" ) && typeof Proxy !== "undefined" ) {
 857      jQuery.cssProps = new Proxy( jQuery.cssProps || {}, {
 858          set: function() {
 859              migrateWarn( "cssProps", "jQuery.cssProps is deprecated" );
 860              return Reflect.set.apply( this, arguments );
 861          }
 862      } );
 863  }
 864  
 865  function isAutoPx( prop ) {
 866  
 867      // The first test is used to ensure that:
 868      // 1. The prop starts with a lowercase letter (as we uppercase it for the second regex).
 869      // 2. The prop is not empty.
 870      return ralphaStart.test( prop ) &&
 871          rautoPx.test( prop[ 0 ].toUpperCase() + prop.slice( 1 ) );
 872  }
 873  
 874  origFnCss = jQuery.fn.css;
 875  
 876  migratePatchFunc( jQuery.fn, "css", function( name, value ) {
 877      var camelName,
 878          origThis = this;
 879  
 880      if ( name && typeof name === "object" && !Array.isArray( name ) ) {
 881          jQuery.each( name, function( n, v ) {
 882              jQuery.fn.css.call( origThis, n, v );
 883          } );
 884          return this;
 885      }
 886  
 887      if ( typeof value === "number" ) {
 888          camelName = camelCase( name );
 889  
 890          if ( !isAutoPx( camelName ) && !jQuery.cssNumber[ camelName ] ) {
 891              migrateWarn( "css-number",
 892                  "Number-typed values are deprecated for jQuery.fn.css( \"" +
 893                  name + "\", value )" );
 894          }
 895      }
 896  
 897      return origFnCss.apply( this, arguments );
 898  }, "css-number" );
 899  
 900  var rmultiDash = /[A-Z]/g,
 901      rnothtmlwhite = /[^\x20\t\r\n\f]+/g,
 902      origJQueryData = jQuery.data,
 903      origJQueryPrivateData = jQuery._data;
 904  
 905  function unCamelCase( str ) {
 906      return str.replace( rmultiDash, "-$&" ).toLowerCase();
 907  }
 908  
 909  function patchDataCamelCase( origData, options ) {
 910      var apiName = options.apiName,
 911          isPrivateData = options.isPrivateData,
 912          isInstanceMethod = options.isInstanceMethod,
 913          origJQueryStaticData = isPrivateData ? origJQueryPrivateData : origJQueryData;
 914  
 915  	function objectSetter( elem, obj ) {
 916          var curData, key;
 917  
 918          // Name can be an object, and each entry in the object is meant
 919          // to be set as data.
 920          // Let the original method handle the case of a missing elem.
 921          if ( elem ) {
 922  
 923              // Don't use the instance method here to avoid `data-*` attributes
 924              // detection this early.
 925              curData = origJQueryStaticData( elem );
 926  
 927              for ( key in obj ) {
 928                  if ( key !== camelCase( key ) ) {
 929                      migrateWarn( "data-camelCase",
 930                          apiName + " always sets/gets camelCased names: " +
 931                              key );
 932                      curData[ key ] = obj[ key ];
 933                  }
 934              }
 935  
 936              // Pass the keys handled above to the original API as well
 937              // so that both the camelCase & initial keys are saved.
 938              if ( isInstanceMethod ) {
 939                  origData.call( this, obj );
 940              } else {
 941                  origData.call( this, elem, obj );
 942              }
 943  
 944              return obj;
 945          }
 946      }
 947  
 948  	function singleSetter( elem, name, value ) {
 949          var curData;
 950  
 951          // If the name is transformed, look for the un-transformed name
 952          // in the data object.
 953          // Let the original method handle the case of a missing elem.
 954          if ( elem ) {
 955  
 956              // Don't use the instance method here to avoid `data-*` attributes
 957              // detection this early.
 958              curData = origJQueryStaticData( elem );
 959  
 960              if ( curData && name in curData ) {
 961                  migrateWarn( "data-camelCase",
 962                      apiName + " always sets/gets camelCased names: " +
 963                          name );
 964  
 965                  curData[ name ] = value;
 966              }
 967  
 968              origJQueryStaticData( elem, name, value );
 969  
 970              // Since the "set" path can have two possible entry points
 971              // return the expected data based on which path was taken.
 972              return value !== undefined ? value : name;
 973          }
 974      }
 975  
 976      return function jQueryDataPatched( elem, name, value ) {
 977          var curData,
 978              that = this,
 979  
 980              // Support: IE 9 only
 981              // IE 9 doesn't support strict mode and later modifications of
 982              // parameters also modify the arguments object in sloppy mode.
 983              // We need the original arguments so save them here.
 984              args = Array.prototype.slice.call( arguments ),
 985  
 986              adjustedArgsLength = args.length;
 987  
 988          if ( isInstanceMethod ) {
 989              value = name;
 990              name = elem;
 991              elem = that[ 0 ];
 992              adjustedArgsLength++;
 993          }
 994  
 995          if ( name && typeof name === "object" && adjustedArgsLength === 2 ) {
 996              if ( isInstanceMethod ) {
 997                  return that.each( function() {
 998                      objectSetter.call( that, this, name );
 999                  } );
1000              } else {
1001                  return objectSetter.call( that, elem, name );
1002              }
1003          }
1004  
1005          // If the name is transformed, look for the un-transformed name
1006          // in the data object.
1007          // Let the original method handle the case of a missing elem.
1008          if ( name && typeof name === "string" && name !== camelCase( name ) &&
1009              adjustedArgsLength > 2 ) {
1010  
1011              if ( isInstanceMethod ) {
1012                  return that.each( function() {
1013                      singleSetter.call( that, this, name, value );
1014                  } );
1015              } else {
1016                  return singleSetter.call( that, elem, name, value );
1017              }
1018          }
1019  
1020          if ( elem && name && typeof name === "string" &&
1021              name !== camelCase( name ) &&
1022              adjustedArgsLength === 2 ) {
1023  
1024              // Don't use the instance method here to avoid `data-*` attributes
1025              // detection this early.
1026              curData = origJQueryStaticData( elem );
1027  
1028              if ( curData && name in curData ) {
1029                  migrateWarn( "data-camelCase",
1030                      apiName + " always sets/gets camelCased names: " +
1031                          name );
1032                  return curData[ name ];
1033              }
1034          }
1035  
1036          return origData.apply( this, args );
1037      };
1038  }
1039  
1040  function patchRemoveDataCamelCase( origRemoveData, options ) {
1041      var isPrivateData = options.isPrivateData,
1042          isInstanceMethod = options.isInstanceMethod,
1043          origJQueryStaticData = isPrivateData ? origJQueryPrivateData : origJQueryData;
1044  
1045  	function remove( elem, keys ) {
1046          var i, singleKey, unCamelCasedKeys,
1047              curData = origJQueryStaticData( elem );
1048  
1049          if ( keys === undefined ) {
1050              origRemoveData( elem );
1051              return;
1052          }
1053  
1054          // Support array or space separated string of keys
1055          if ( !Array.isArray( keys ) ) {
1056  
1057              // If a key with the spaces exists, use it.
1058              // Otherwise, create an array by matching non-whitespace
1059              keys = keys in curData ?
1060                  [ keys ] :
1061                  ( keys.match( rnothtmlwhite ) || [] );
1062          }
1063  
1064          // Remove:
1065          // * the original keys as passed
1066          // * their "unCamelCased" version
1067          // * their camelCase version
1068          // These may be three distinct values for each key!
1069          // jQuery 3.x only removes camelCase versions by default. However, in this patch
1070          // we set the original keys in the mass-setter case and if the key already exists
1071          // so without removing the "unCamelCased" versions the following would be broken:
1072          // ```js
1073          // elem.data( { "a-a": 1 } ).removeData( "aA" );
1074          // ```
1075          // Unfortunately, we'll still hit this issue for partially camelCased keys, e.g.:
1076          // ```js
1077          // elem.data( { "a-aA": 1 } ).removeData( "aAA" );
1078          // ```
1079          // won't work with this patch. We consider this an edge case, but to make sure that
1080          // at least piggybacking works:
1081          // ```js
1082          // elem.data( { "a-aA": 1 } ).removeData( "a-aA" );
1083          // ```
1084          // we also remove the original key. Hence, all three are needed.
1085          // The original API already removes the camelCase versions, though, so let's defer
1086          // to it.
1087          unCamelCasedKeys = keys.map( unCamelCase );
1088  
1089          i = keys.length;
1090          while ( i-- ) {
1091              singleKey = keys[ i ];
1092              if ( singleKey !== camelCase( singleKey ) && singleKey in curData ) {
1093                  migrateWarn( "data-camelCase",
1094                      "jQuery" + ( isInstanceMethod ? ".fn" : "" ) +
1095                      ".data() always sets/gets camelCased names: " +
1096                      singleKey );
1097              }
1098              delete curData[ singleKey ];
1099          }
1100  
1101          // Don't warn when removing "unCamelCased" keys; we're already printing
1102          // a warning when setting them and the fix is needed there, not in
1103          // the `.removeData()` call.
1104          i = unCamelCasedKeys.length;
1105          while ( i-- ) {
1106              delete curData[ unCamelCasedKeys[ i ] ];
1107          }
1108  
1109          origRemoveData( elem, keys );
1110      }
1111  
1112      return function jQueryRemoveDataPatched( elem, key ) {
1113          if ( isInstanceMethod ) {
1114              key = elem;
1115              return this.each( function() {
1116                  remove( this, key );
1117              } );
1118          } else {
1119              remove( elem, key );
1120          }
1121      };
1122  }
1123  
1124  migratePatchFunc( jQuery, "data",
1125      patchDataCamelCase( jQuery.data, {
1126          apiName: "jQuery.data()",
1127          isPrivateData: false,
1128          isInstanceMethod: false
1129      } ),
1130      "data-camelCase" );
1131  migratePatchFunc( jQuery, "_data",
1132      patchDataCamelCase( jQuery._data, {
1133          apiName: "jQuery._data()",
1134          isPrivateData: true,
1135          isInstanceMethod: false
1136      } ),
1137      "data-camelCase" );
1138  migratePatchFunc( jQuery.fn, "data",
1139      patchDataCamelCase( jQuery.fn.data, {
1140          apiName: "jQuery.fn.data()",
1141          isPrivateData: false,
1142          isInstanceMethod: true
1143      } ),
1144      "data-camelCase" );
1145  
1146  migratePatchFunc( jQuery, "removeData",
1147      patchRemoveDataCamelCase( jQuery.removeData, {
1148          isPrivateData: false,
1149          isInstanceMethod: false
1150      } ),
1151      "data-camelCase" );
1152  migratePatchFunc( jQuery, "_removeData",
1153      patchRemoveDataCamelCase( jQuery._removeData, {
1154          isPrivateData: true,
1155          isInstanceMethod: false
1156      } ),
1157      "data-camelCase" );
1158  migratePatchFunc( jQuery.fn, "removeData",
1159  
1160      // No, it's not a typo - we're intentionally passing
1161      // the static method here as we need something working on
1162      // a single element.
1163      patchRemoveDataCamelCase( jQuery.removeData, {
1164          isPrivateData: false,
1165          isInstanceMethod: true
1166      } ),
1167      "data-camelCase" );
1168  
1169  function patchDataProto( original, options ) {
1170      var warningId = options.warningId,
1171          apiName = options.apiName,
1172          isInstanceMethod = options.isInstanceMethod;
1173  
1174      return function apiWithProtoPatched() {
1175          var result = original.apply( this, arguments );
1176  
1177          if ( arguments.length !== ( isInstanceMethod ? 0 : 1 ) || result === undefined ) {
1178              return result;
1179          }
1180  
1181          patchProto( result, {
1182              warningId: warningId,
1183              apiName: apiName
1184          } );
1185  
1186          return result;
1187      };
1188  }
1189  
1190  // Yes, we are patching jQuery.data twice; here & above. This is necessary
1191  // so that each of the two patches can be independently disabled.
1192  migratePatchFunc( jQuery, "data",
1193      patchDataProto( jQuery.data, {
1194          warningId: "data-null-proto",
1195          apiName: "jQuery.data()",
1196          isInstanceMethod: false
1197      } ),
1198      "data-null-proto" );
1199  migratePatchFunc( jQuery, "_data",
1200      patchDataProto( jQuery._data, {
1201          warningId: "data-null-proto",
1202          apiName: "jQuery._data()",
1203          isInstanceMethod: false
1204      } ),
1205      "data-null-proto" );
1206  migratePatchFunc( jQuery.fn, "data",
1207      patchDataProto( jQuery.fn.data, {
1208          warningId: "data-null-proto",
1209          apiName: "jQuery.fn.data()",
1210          isInstanceMethod: true
1211      } ),
1212      "data-null-proto" );
1213  
1214  // Support jQuery slim which excludes the effects module
1215  if ( jQuery.fx ) {
1216  
1217  var intervalValue, intervalMsg,
1218      oldTweenRun = jQuery.Tween.prototype.run,
1219      linearEasing = function( pct ) {
1220          return pct;
1221      };
1222  
1223  migratePatchFunc( jQuery.Tween.prototype, "run", function( ) {
1224      if ( jQuery.easing[ this.easing ].length > 1 ) {
1225          migrateWarn(
1226              "easing-one-arg",
1227              "'jQuery.easing." + this.easing.toString() + "' should use only one argument"
1228          );
1229  
1230          jQuery.easing[ this.easing ] = linearEasing;
1231      }
1232  
1233      oldTweenRun.apply( this, arguments );
1234  }, "easing-one-arg" );
1235  
1236  intervalValue = jQuery.fx.interval;
1237  intervalMsg = "jQuery.fx.interval is deprecated";
1238  
1239  // Support: IE9, Android <=4.4
1240  // Avoid false positives on browsers that lack rAF
1241  // Don't warn if document is hidden, jQuery uses setTimeout (#292)
1242  if ( window.requestAnimationFrame ) {
1243      Object.defineProperty( jQuery.fx, "interval", {
1244          configurable: true,
1245          enumerable: true,
1246          get: function() {
1247              if ( !window.document.hidden ) {
1248                  migrateWarn( "fx-interval", intervalMsg );
1249              }
1250  
1251              // Only fallback to the default if patch is enabled
1252              if ( !jQuery.migrateIsPatchEnabled( "fx-interval" ) ) {
1253                  return intervalValue;
1254              }
1255              return intervalValue === undefined ? 13 : intervalValue;
1256          },
1257          set: function( newValue ) {
1258              migrateWarn( "fx-interval", intervalMsg );
1259              intervalValue = newValue;
1260          }
1261      } );
1262  }
1263  
1264  }
1265  
1266  var oldLoad = jQuery.fn.load,
1267      oldEventAdd = jQuery.event.add,
1268      originalFix = jQuery.event.fix;
1269  
1270  jQuery.event.props = [];
1271  jQuery.event.fixHooks = {};
1272  
1273  migrateWarnProp( jQuery.event.props, "concat", jQuery.event.props.concat,
1274      "event-old-patch",
1275      "jQuery.event.props.concat() is deprecated and removed" );
1276  
1277  migratePatchFunc( jQuery.event, "fix", function( originalEvent ) {
1278      var event,
1279          type = originalEvent.type,
1280          fixHook = this.fixHooks[ type ],
1281          props = jQuery.event.props;
1282  
1283      if ( props.length ) {
1284          migrateWarn( "event-old-patch",
1285              "jQuery.event.props are deprecated and removed: " + props.join() );
1286          while ( props.length ) {
1287              jQuery.event.addProp( props.pop() );
1288          }
1289      }
1290  
1291      if ( fixHook && !fixHook._migrated_ ) {
1292          fixHook._migrated_ = true;
1293          migrateWarn( "event-old-patch",
1294              "jQuery.event.fixHooks are deprecated and removed: " + type );
1295          if ( ( props = fixHook.props ) && props.length ) {
1296              while ( props.length ) {
1297                  jQuery.event.addProp( props.pop() );
1298              }
1299          }
1300      }
1301  
1302      event = originalFix.call( this, originalEvent );
1303  
1304      return fixHook && fixHook.filter ?
1305          fixHook.filter( event, originalEvent ) :
1306          event;
1307  }, "event-old-patch" );
1308  
1309  migratePatchFunc( jQuery.event, "add", function( elem, types ) {
1310  
1311      // This misses the multiple-types case but that seems awfully rare
1312      if ( elem === window && types === "load" && window.document.readyState === "complete" ) {
1313          migrateWarn( "load-after-event",
1314              "jQuery(window).on('load'...) called after load event occurred" );
1315      }
1316      return oldEventAdd.apply( this, arguments );
1317  }, "load-after-event" );
1318  
1319  jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
1320  
1321      migratePatchFunc( jQuery.fn, name, function() {
1322          var args = Array.prototype.slice.call( arguments, 0 );
1323  
1324          // If this is an ajax load() the first arg should be the string URL;
1325          // technically this could also be the "Anything" arg of the event .load()
1326          // which just goes to show why this dumb signature has been deprecated!
1327          // jQuery custom builds that exclude the Ajax module justifiably die here.
1328          if ( name === "load" && typeof args[ 0 ] === "string" ) {
1329              return oldLoad.apply( this, args );
1330          }
1331  
1332          migrateWarn( "shorthand-removed-v3",
1333              "jQuery.fn." + name + "() is deprecated" );
1334  
1335          args.splice( 0, 0, name );
1336          if ( arguments.length ) {
1337              return this.on.apply( this, args );
1338          }
1339  
1340          // Use .triggerHandler here because:
1341          // - load and unload events don't need to bubble, only applied to window or image
1342          // - error event should not bubble to window, although it does pre-1.7
1343          // See http://bugs.jquery.com/ticket/11820
1344          this.triggerHandler.apply( this, args );
1345          return this;
1346      }, "shorthand-removed-v3" );
1347  
1348  } );
1349  
1350  jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
1351      "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
1352      "change select submit keydown keypress keyup contextmenu" ).split( " " ),
1353  function( _i, name ) {
1354  
1355      // Handle event binding
1356      migratePatchAndWarnFunc( jQuery.fn, name, jQuery.fn[ name ], "shorthand-deprecated-v3",
1357          "DEPRECATED: jQuery.fn." + name + "() event shorthand" );
1358  
1359  } );
1360  
1361  // Trigger "ready" event only once, on document ready
1362  jQuery( function() {
1363      jQuery( window.document ).triggerHandler( "ready" );
1364  } );
1365  
1366  jQuery.event.special.ready = {
1367      setup: function() {
1368          if ( this === window.document ) {
1369              migrateWarn( "ready-event", "'ready' event is deprecated" );
1370          }
1371      }
1372  };
1373  
1374  // Support: jQuery <3.2.0 only
1375  // jQuery 3.0.x & 3.1.x used to not include the deprecated module in the slim build.
1376  // To maintain compatibility with those versions, we need to reimplement APIs
1377  // deprecated in them.
1378  // See https://github.com/jquery/jquery/blob/3.1.1/src/deprecated.js
1379  migratePatchAndWarnFunc( jQuery.fn, "bind", function( types, data, fn ) {
1380      return this.on( types, null, data, fn );
1381  }, "pre-on-methods", "jQuery.fn.bind() is deprecated" );
1382  migratePatchAndWarnFunc( jQuery.fn, "unbind", function( types, fn ) {
1383      return this.off( types, null, fn );
1384  }, "pre-on-methods", "jQuery.fn.unbind() is deprecated" );
1385  migratePatchAndWarnFunc( jQuery.fn, "delegate", function( selector, types, data, fn ) {
1386      return this.on( types, selector, data, fn );
1387  }, "pre-on-methods", "jQuery.fn.delegate() is deprecated" );
1388  migratePatchAndWarnFunc( jQuery.fn, "undelegate", function( selector, types, fn ) {
1389      return arguments.length === 1 ?
1390          this.off( selector, "**" ) :
1391          this.off( types, selector || "**", fn );
1392  }, "pre-on-methods", "jQuery.fn.undelegate() is deprecated" );
1393  migratePatchAndWarnFunc( jQuery.fn, "hover", function( fnOver, fnOut ) {
1394      return this.on( "mouseenter", fnOver ).on( "mouseleave", fnOut || fnOver );
1395  }, "pre-on-methods", "jQuery.fn.hover() is deprecated" );
1396  
1397  // We can apply the patch unconditionally here as in the `3.x` line the API
1398  // inherits from `Object.prototype` even without a patch and `migrateWarn`
1399  // inside `patchProto` will already silence warnings if the patch gets disabled.
1400  patchProto( jQuery.event.special, {
1401      warningId: "event-special-null-proto",
1402      apiName: "jQuery.event.special"
1403  } );
1404  
1405  var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
1406      makeMarkup = function( html ) {
1407          var doc = window.document.implementation.createHTMLDocument( "" );
1408          doc.body.innerHTML = html;
1409          return doc.body && doc.body.innerHTML;
1410      },
1411      warnIfChanged = function( html ) {
1412          var changed = html.replace( rxhtmlTag, "<$1></$2>" );
1413          if ( changed !== html && makeMarkup( html ) !== makeMarkup( changed ) ) {
1414              migrateWarn( "self-closed-tags",
1415                  "HTML tags must be properly nested and closed: " + html );
1416          }
1417      };
1418  
1419  /**
1420   * Deprecated, please use `jQuery.migrateDisablePatches( "self-closed-tags" )` instead.
1421   * @deprecated
1422   */
1423  migratePatchAndWarnFunc( jQuery, "UNSAFE_restoreLegacyHtmlPrefilter", function() {
1424      jQuery.migrateEnablePatches( "self-closed-tags" );
1425  }, "legacy-self-closed-tags",
1426  "jQuery.UNSAFE_restoreLegacyHtmlPrefilter deprecated; use " +
1427      "`jQuery.migrateEnablePatches( \"self-closed-tags\" )`" );
1428  
1429  migratePatchFunc( jQuery, "htmlPrefilter", function( html ) {
1430      warnIfChanged( html );
1431      return html.replace( rxhtmlTag, "<$1></$2>" );
1432  }, "self-closed-tags" );
1433  
1434  // This patch needs to be disabled by default as it re-introduces
1435  // security issues (CVE-2020-11022, CVE-2020-11023).
1436  jQuery.migrateDisablePatches( "self-closed-tags" );
1437  
1438  var origOffset = jQuery.fn.offset;
1439  
1440  migratePatchFunc( jQuery.fn, "offset", function() {
1441      var elem = this[ 0 ];
1442  
1443      if ( elem && ( !elem.nodeType || !elem.getBoundingClientRect ) ) {
1444          migrateWarn( "offset-valid-elem", "jQuery.fn.offset() requires a valid DOM element" );
1445          return arguments.length ? this : undefined;
1446      }
1447  
1448      return origOffset.apply( this, arguments );
1449  }, "offset-valid-elem" );
1450  
1451  // Support jQuery slim which excludes the ajax module
1452  // The jQuery.param patch is about respecting `jQuery.ajaxSettings.traditional`
1453  // so it doesn't make sense for the slim build.
1454  if ( jQuery.ajax ) {
1455  
1456  var origParam = jQuery.param;
1457  
1458  migratePatchFunc( jQuery, "param", function( data, traditional ) {
1459      var ajaxTraditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
1460  
1461      if ( traditional === undefined && ajaxTraditional ) {
1462  
1463          migrateWarn( "param-ajax-traditional",
1464              "jQuery.param() no longer uses jQuery.ajaxSettings.traditional" );
1465          traditional = ajaxTraditional;
1466      }
1467  
1468      return origParam.call( this, data, traditional );
1469  }, "param-ajax-traditional" );
1470  
1471  }
1472  
1473  migratePatchAndWarnFunc( jQuery.fn, "andSelf", jQuery.fn.addBack, "andSelf",
1474      "jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()" );
1475  
1476  // Support jQuery slim which excludes the deferred module in jQuery 4.0+
1477  if ( jQuery.Deferred ) {
1478  
1479  var unpatchedGetStackHookValue,
1480      oldDeferred = jQuery.Deferred,
1481      tuples = [
1482  
1483          // Action, add listener, callbacks, .then handlers, final state
1484          [ "resolve", "done", jQuery.Callbacks( "once memory" ),
1485              jQuery.Callbacks( "once memory" ), "resolved" ],
1486          [ "reject", "fail", jQuery.Callbacks( "once memory" ),
1487              jQuery.Callbacks( "once memory" ), "rejected" ],
1488          [ "notify", "progress", jQuery.Callbacks( "memory" ),
1489              jQuery.Callbacks( "memory" ) ]
1490      ];
1491  
1492  migratePatchFunc( jQuery, "Deferred", function( func ) {
1493      var deferred = oldDeferred(),
1494          promise = deferred.promise();
1495  
1496  	function newDeferredPipe( /* fnDone, fnFail, fnProgress */ ) {
1497          var fns = arguments;
1498  
1499          return jQuery.Deferred( function( newDefer ) {
1500              jQuery.each( tuples, function( i, tuple ) {
1501                  var fn = typeof fns[ i ] === "function" && fns[ i ];
1502  
1503                  // Deferred.done(function() { bind to newDefer or newDefer.resolve })
1504                  // deferred.fail(function() { bind to newDefer or newDefer.reject })
1505                  // deferred.progress(function() { bind to newDefer or newDefer.notify })
1506                  deferred[ tuple[ 1 ] ]( function() {
1507                      var returned = fn && fn.apply( this, arguments );
1508                      if ( returned && typeof returned.promise === "function" ) {
1509                          returned.promise()
1510                              .done( newDefer.resolve )
1511                              .fail( newDefer.reject )
1512                              .progress( newDefer.notify );
1513                      } else {
1514                          newDefer[ tuple[ 0 ] + "With" ](
1515                              this === promise ? newDefer.promise() : this,
1516                              fn ? [ returned ] : arguments
1517                          );
1518                      }
1519                  } );
1520              } );
1521              fns = null;
1522          } ).promise();
1523      }
1524  
1525      migratePatchAndWarnFunc( deferred, "pipe", newDeferredPipe, "deferred-pipe",
1526          "deferred.pipe() is deprecated" );
1527      migratePatchAndWarnFunc( promise, "pipe", newDeferredPipe, "deferred-pipe",
1528          "deferred.pipe() is deprecated" );
1529  
1530      if ( func ) {
1531          func.call( deferred, deferred );
1532      }
1533  
1534      return deferred;
1535  }, "deferred-pipe" );
1536  
1537  // Preserve handler of uncaught exceptions in promise chains
1538  jQuery.Deferred.exceptionHook = oldDeferred.exceptionHook;
1539  
1540  // Preserve the optional hook to record the error, if defined
1541  jQuery.Deferred.getErrorHook = oldDeferred.getErrorHook;
1542  
1543  // We want to mirror jQuery.Deferred.getErrorHook here, so we cannot use
1544  // existing Migrate utils.
1545  Object.defineProperty( jQuery.Deferred, "getStackHook", {
1546      configurable: true,
1547      enumerable: true,
1548      get: function() {
1549          if ( jQuery.migrateIsPatchEnabled( "deferred-getStackHook" ) ) {
1550  
1551              // jQuery 3.x checks `getStackHook` if `getErrorHook` is missing,
1552              // so don't warn on the getter.
1553              return jQuery.Deferred.getErrorHook;
1554          } else {
1555              return unpatchedGetStackHookValue;
1556          }
1557      },
1558      set: function( newValue ) {
1559          if ( jQuery.migrateIsPatchEnabled( "deferred-getStackHook" ) ) {
1560  
1561              // Only warn if `getErrorHook` wasn't set to the same value first.
1562              if ( jQuery.Deferred.getErrorHook !== newValue ) {
1563                  migrateWarn( "deferred-getStackHook",
1564                      "jQuery.Deferred.getStackHook is deprecated; " +
1565                      "use jQuery.Deferred.getErrorHook" );
1566                  jQuery.Deferred.getErrorHook = newValue;
1567              }
1568          } else {
1569              unpatchedGetStackHookValue = newValue;
1570          }
1571      }
1572  } );
1573  
1574  }
1575  
1576  return jQuery;
1577  } );


Generated : Sun Oct 11 08:20:32 2026 Cross-referenced by PHPXref