[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/lib/scripts/jquery/ -> jquery-migrate.js (source)

   1  /*!
   2   * jQuery Migrate - v1.3.0 - 2016-01-13
   3   * Copyright jQuery Foundation and other contributors
   4   */
   5  (function( jQuery, window, undefined ) {
   6  // See http://bugs.jquery.com/ticket/13335
   7  // "use strict";
   8  
   9  
  10  jQuery.migrateVersion = "1.3.0";
  11  
  12  
  13  var warnedAbout = {};
  14  
  15  // List of warnings already given; public read only
  16  jQuery.migrateWarnings = [];
  17  
  18  // Set to true to prevent console output; migrateWarnings still maintained
  19  // jQuery.migrateMute = false;
  20  
  21  // Show a message on the console so devs know we're active
  22  if ( !jQuery.migrateMute && window.console && window.console.log ) {
  23      window.console.log("JQMIGRATE: Logging is active");
  24  }
  25  
  26  // Set to false to disable traces that appear with warnings
  27  if ( jQuery.migrateTrace === undefined ) {
  28      jQuery.migrateTrace = true;
  29  }
  30  
  31  // Forget any warnings we've already given; public
  32  jQuery.migrateReset = function() {
  33      warnedAbout = {};
  34      jQuery.migrateWarnings.length = 0;
  35  };
  36  
  37  function migrateWarn( msg) {
  38      var console = window.console;
  39      if ( !warnedAbout[ msg ] ) {
  40          warnedAbout[ msg ] = true;
  41          jQuery.migrateWarnings.push( msg );
  42          if ( console && console.warn && !jQuery.migrateMute ) {
  43              console.warn( "JQMIGRATE: " + msg );
  44              if ( jQuery.migrateTrace && console.trace ) {
  45                  console.trace();
  46              }
  47          }
  48      }
  49  }
  50  
  51  function migrateWarnProp( obj, prop, value, msg ) {
  52      if ( Object.defineProperty ) {
  53          // On ES5 browsers (non-oldIE), warn if the code tries to get prop;
  54          // allow property to be overwritten in case some other plugin wants it
  55          try {
  56              Object.defineProperty( obj, prop, {
  57                  configurable: true,
  58                  enumerable: true,
  59                  get: function() {
  60                      migrateWarn( msg );
  61                      return value;
  62                  },
  63                  set: function( newValue ) {
  64                      migrateWarn( msg );
  65                      value = newValue;
  66                  }
  67              });
  68              return;
  69          } catch( err ) {
  70              // IE8 is a dope about Object.defineProperty, can't warn there
  71          }
  72      }
  73  
  74      // Non-ES5 (or broken) browser; just set the property
  75      jQuery._definePropertyBroken = true;
  76      obj[ prop ] = value;
  77  }
  78  
  79  if ( document.compatMode === "BackCompat" ) {
  80      // jQuery has never supported or tested Quirks Mode
  81      migrateWarn( "jQuery is not compatible with Quirks Mode" );
  82  }
  83  
  84  
  85  var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
  86      oldAttr = jQuery.attr,
  87      valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
  88          function() { return null; },
  89      valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
  90          function() { return undefined; },
  91      rnoType = /^(?:input|button)$/i,
  92      rnoAttrNodeType = /^[238]$/,
  93      rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
  94      ruseDefault = /^(?:checked|selected)$/i;
  95  
  96  // jQuery.attrFn
  97  migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" );
  98  
  99  jQuery.attr = function( elem, name, value, pass ) {
 100      var lowerName = name.toLowerCase(),
 101          nType = elem && elem.nodeType;
 102  
 103      if ( pass ) {
 104          // Since pass is used internally, we only warn for new jQuery
 105          // versions where there isn't a pass arg in the formal params
 106          if ( oldAttr.length < 4 ) {
 107              migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
 108          }
 109          if ( elem && !rnoAttrNodeType.test( nType ) &&
 110              (attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {
 111              return jQuery( elem )[ name ]( value );
 112          }
 113      }
 114  
 115      // Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
 116      // for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
 117      if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
 118          migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
 119      }
 120  
 121      // Restore boolHook for boolean property/attribute synchronization
 122      if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
 123          jQuery.attrHooks[ lowerName ] = {
 124              get: function( elem, name ) {
 125                  // Align boolean attributes with corresponding properties
 126                  // Fall back to attribute presence where some booleans are not supported
 127                  var attrNode,
 128                      property = jQuery.prop( elem, name );
 129                  return property === true || typeof property !== "boolean" &&
 130                      ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
 131  
 132                      name.toLowerCase() :
 133                      undefined;
 134              },
 135              set: function( elem, value, name ) {
 136                  var propName;
 137                  if ( value === false ) {
 138                      // Remove boolean attributes when set to false
 139                      jQuery.removeAttr( elem, name );
 140                  } else {
 141                      // value is true since we know at this point it's type boolean and not false
 142                      // Set boolean attributes to the same name and set the DOM property
 143                      propName = jQuery.propFix[ name ] || name;
 144                      if ( propName in elem ) {
 145                          // Only set the IDL specifically if it already exists on the element
 146                          elem[ propName ] = true;
 147                      }
 148  
 149                      elem.setAttribute( name, name.toLowerCase() );
 150                  }
 151                  return name;
 152              }
 153          };
 154  
 155          // Warn only for attributes that can remain distinct from their properties post-1.9
 156          if ( ruseDefault.test( lowerName ) ) {
 157              migrateWarn( "jQuery.fn.attr('" + lowerName + "') might use property instead of attribute" );
 158          }
 159      }
 160  
 161      return oldAttr.call( jQuery, elem, name, value );
 162  };
 163  
 164  // attrHooks: value
 165  jQuery.attrHooks.value = {
 166      get: function( elem, name ) {
 167          var nodeName = ( elem.nodeName || "" ).toLowerCase();
 168          if ( nodeName === "button" ) {
 169              return valueAttrGet.apply( this, arguments );
 170          }
 171          if ( nodeName !== "input" && nodeName !== "option" ) {
 172              migrateWarn("jQuery.fn.attr('value') no longer gets properties");
 173          }
 174          return name in elem ?
 175              elem.value :
 176              null;
 177      },
 178      set: function( elem, value ) {
 179          var nodeName = ( elem.nodeName || "" ).toLowerCase();
 180          if ( nodeName === "button" ) {
 181              return valueAttrSet.apply( this, arguments );
 182          }
 183          if ( nodeName !== "input" && nodeName !== "option" ) {
 184              migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
 185          }
 186          // Does not return so that setAttribute is also used
 187          elem.value = value;
 188      }
 189  };
 190  
 191  
 192  var matched, browser,
 193      oldInit = jQuery.fn.init,
 194      oldParseJSON = jQuery.parseJSON,
 195      rspaceAngle = /^\s*</,
 196      // Note: XSS check is done below after string is trimmed
 197      rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/;
 198  
 199  // $(html) "looks like html" rule change
 200  jQuery.fn.init = function( selector, context, rootjQuery ) {
 201      var match, ret;
 202  
 203      if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
 204              (match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
 205          // This is an HTML string according to the "old" rules; is it still?
 206          if ( !rspaceAngle.test( selector ) ) {
 207              migrateWarn("$(html) HTML strings must start with '<' character");
 208          }
 209          if ( match[ 3 ] ) {
 210              migrateWarn("$(html) HTML text after last tag is ignored");
 211          }
 212  
 213          // Consistently reject any HTML-like string starting with a hash (#9521)
 214          // Note that this may break jQuery 1.6.x code that otherwise would work.
 215          if ( match[ 0 ].charAt( 0 ) === "#" ) {
 216              migrateWarn("HTML string cannot start with a '#' character");
 217              jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
 218          }
 219          // Now process using loose rules; let pre-1.8 play too
 220          if ( context && context.context ) {
 221              // jQuery object as context; parseHTML expects a DOM object
 222              context = context.context;
 223          }
 224          if ( jQuery.parseHTML ) {
 225              return oldInit.call( this,
 226                      jQuery.parseHTML( match[ 2 ], context && context.ownerDocument ||
 227                          context || document, true ), context, rootjQuery );
 228          }
 229      }
 230  
 231      // jQuery( "#" ) is a bogus ID selector, but it returned an empty set before jQuery 3.0
 232      if ( selector === "#" ) {
 233          migrateWarn( "jQuery( '#' ) is not a valid selector" );
 234          selector = [];
 235      }
 236  
 237      ret = oldInit.apply( this, arguments );
 238  
 239      // Fill in selector and context properties so .live() works
 240      if ( selector && selector.selector !== undefined ) {
 241          // A jQuery object, copy its properties
 242          ret.selector = selector.selector;
 243          ret.context = selector.context;
 244  
 245      } else {
 246          ret.selector = typeof selector === "string" ? selector : "";
 247          if ( selector ) {
 248              ret.context = selector.nodeType? selector : context || document;
 249          }
 250      }
 251  
 252      return ret;
 253  };
 254  jQuery.fn.init.prototype = jQuery.fn;
 255  
 256  // Let $.parseJSON(falsy_value) return null
 257  jQuery.parseJSON = function( json ) {
 258      if ( !json ) {
 259          migrateWarn("jQuery.parseJSON requires a valid JSON string");
 260          return null;
 261      }
 262      return oldParseJSON.apply( this, arguments );
 263  };
 264  
 265  jQuery.uaMatch = function( ua ) {
 266      ua = ua.toLowerCase();
 267  
 268      var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
 269          /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
 270          /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
 271          /(msie) ([\w.]+)/.exec( ua ) ||
 272          ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
 273          [];
 274  
 275      return {
 276          browser: match[ 1 ] || "",
 277          version: match[ 2 ] || "0"
 278      };
 279  };
 280  
 281  // Don't clobber any existing jQuery.browser in case it's different
 282  if ( !jQuery.browser ) {
 283      matched = jQuery.uaMatch( navigator.userAgent );
 284      browser = {};
 285  
 286      if ( matched.browser ) {
 287          browser[ matched.browser ] = true;
 288          browser.version = matched.version;
 289      }
 290  
 291      // Chrome is Webkit, but Webkit is also Safari.
 292      if ( browser.chrome ) {
 293          browser.webkit = true;
 294      } else if ( browser.webkit ) {
 295          browser.safari = true;
 296      }
 297  
 298      jQuery.browser = browser;
 299  }
 300  
 301  // Warn if the code tries to get jQuery.browser
 302  migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
 303  
 304  // jQuery.boxModel deprecated in 1.3, jQuery.support.boxModel deprecated in 1.7
 305  jQuery.boxModel = jQuery.support.boxModel = (document.compatMode === "CSS1Compat");
 306  migrateWarnProp( jQuery, "boxModel", jQuery.boxModel, "jQuery.boxModel is deprecated" );
 307  migrateWarnProp( jQuery.support, "boxModel", jQuery.support.boxModel, "jQuery.support.boxModel is deprecated" );
 308  
 309  jQuery.sub = function() {
 310      function jQuerySub( selector, context ) {
 311          return new jQuerySub.fn.init( selector, context );
 312      }
 313      jQuery.extend( true, jQuerySub, this );
 314      jQuerySub.superclass = this;
 315      jQuerySub.fn = jQuerySub.prototype = this();
 316      jQuerySub.fn.constructor = jQuerySub;
 317      jQuerySub.sub = this.sub;
 318      jQuerySub.fn.init = function init( selector, context ) {
 319          var instance = jQuery.fn.init.call( this, selector, context, rootjQuerySub );
 320          return instance instanceof jQuerySub ?
 321              instance :
 322              jQuerySub( instance );
 323      };
 324      jQuerySub.fn.init.prototype = jQuerySub.fn;
 325      var rootjQuerySub = jQuerySub(document);
 326      migrateWarn( "jQuery.sub() is deprecated" );
 327      return jQuerySub;
 328  };
 329  
 330  // The number of elements contained in the matched element set
 331  jQuery.fn.size = function() {
 332      migrateWarn( "jQuery.fn.size() is deprecated; use the .length property" );
 333      return this.length;
 334  };
 335  
 336  
 337  var internalSwapCall = false;
 338  
 339  // If this version of jQuery has .swap(), don't false-alarm on internal uses
 340  if ( jQuery.swap ) {
 341      jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
 342          var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
 343  
 344          if ( oldHook ) {
 345              jQuery.cssHooks[ name ].get = function() {
 346                  var ret;
 347  
 348                  internalSwapCall = true;
 349                  ret = oldHook.apply( this, arguments );
 350                  internalSwapCall = false;
 351                  return ret;
 352              };
 353          }
 354      });
 355  }
 356  
 357  jQuery.swap = function( elem, options, callback, args ) {
 358      var ret, name,
 359          old = {};
 360  
 361      if ( !internalSwapCall ) {
 362          migrateWarn( "jQuery.swap() is undocumented and deprecated" );
 363      }
 364  
 365      // Remember the old values, and insert the new ones
 366      for ( name in options ) {
 367          old[ name ] = elem.style[ name ];
 368          elem.style[ name ] = options[ name ];
 369      }
 370  
 371      ret = callback.apply( elem, args || [] );
 372  
 373      // Revert the old values
 374      for ( name in options ) {
 375          elem.style[ name ] = old[ name ];
 376      }
 377  
 378      return ret;
 379  };
 380  
 381  
 382  // Ensure that $.ajax gets the new parseJSON defined in core.js
 383  jQuery.ajaxSetup({
 384      converters: {
 385          "text json": jQuery.parseJSON
 386      }
 387  });
 388  
 389  
 390  var oldFnData = jQuery.fn.data;
 391  
 392  jQuery.fn.data = function( name ) {
 393      var ret, evt,
 394          elem = this[0];
 395  
 396      // Handles 1.7 which has this behavior and 1.8 which doesn't
 397      if ( elem && name === "events" && arguments.length === 1 ) {
 398          ret = jQuery.data( elem, name );
 399          evt = jQuery._data( elem, name );
 400          if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
 401              migrateWarn("Use of jQuery.fn.data('events') is deprecated");
 402              return evt;
 403          }
 404      }
 405      return oldFnData.apply( this, arguments );
 406  };
 407  
 408  
 409  var rscriptType = /\/(java|ecma)script/i;
 410  
 411  // Since jQuery.clean is used internally on older versions, we only shim if it's missing
 412  if ( !jQuery.clean ) {
 413      jQuery.clean = function( elems, context, fragment, scripts ) {
 414          // Set context per 1.8 logic
 415          context = context || document;
 416          context = !context.nodeType && context[0] || context;
 417          context = context.ownerDocument || context;
 418  
 419          migrateWarn("jQuery.clean() is deprecated");
 420  
 421          var i, elem, handleScript, jsTags,
 422              ret = [];
 423  
 424          jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
 425  
 426          // Complex logic lifted directly from jQuery 1.8
 427          if ( fragment ) {
 428              // Special handling of each script element
 429              handleScript = function( elem ) {
 430                  // Check if we consider it executable
 431                  if ( !elem.type || rscriptType.test( elem.type ) ) {
 432                      // Detach the script and store it in the scripts array (if provided) or the fragment
 433                      // Return truthy to indicate that it has been handled
 434                      return scripts ?
 435                          scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
 436                          fragment.appendChild( elem );
 437                  }
 438              };
 439  
 440              for ( i = 0; (elem = ret[i]) != null; i++ ) {
 441                  // Check if we're done after handling an executable script
 442                  if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
 443                      // Append to fragment and handle embedded scripts
 444                      fragment.appendChild( elem );
 445                      if ( typeof elem.getElementsByTagName !== "undefined" ) {
 446                          // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
 447                          jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
 448  
 449                          // Splice the scripts into ret after their former ancestor and advance our index beyond them
 450                          ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
 451                          i += jsTags.length;
 452                      }
 453                  }
 454              }
 455          }
 456  
 457          return ret;
 458      };
 459  }
 460  
 461  var eventAdd = jQuery.event.add,
 462      eventRemove = jQuery.event.remove,
 463      eventTrigger = jQuery.event.trigger,
 464      oldToggle = jQuery.fn.toggle,
 465      oldLive = jQuery.fn.live,
 466      oldDie = jQuery.fn.die,
 467      oldLoad = jQuery.fn.load,
 468      ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
 469      rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
 470      rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
 471      hoverHack = function( events ) {
 472          if ( typeof( events ) !== "string" || jQuery.event.special.hover ) {
 473              return events;
 474          }
 475          if ( rhoverHack.test( events ) ) {
 476              migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
 477          }
 478          return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
 479      };
 480  
 481  // Event props removed in 1.9, put them back if needed; no practical way to warn them
 482  if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
 483      jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
 484  }
 485  
 486  // Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
 487  if ( jQuery.event.dispatch ) {
 488      migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
 489  }
 490  
 491  // Support for 'hover' pseudo-event and ajax event warnings
 492  jQuery.event.add = function( elem, types, handler, data, selector ){
 493      if ( elem !== document && rajaxEvent.test( types ) ) {
 494          migrateWarn( "AJAX events should be attached to document: " + types );
 495      }
 496      eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
 497  };
 498  jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
 499      eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
 500  };
 501  
 502  jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
 503  
 504      jQuery.fn[ name ] = function() {
 505          var args = Array.prototype.slice.call( arguments, 0 );
 506          migrateWarn( "jQuery.fn." + name + "() is deprecated" );
 507  
 508          // If this is an ajax load() the first arg should be the string URL;
 509          // technically this could also be the "Anything" arg of the event .load()
 510          // which just goes to show why this dumb signature has been deprecated!
 511          // jQuery custom builds that exclude the Ajax module justifiably die here.
 512          if ( name === "load" && typeof arguments[ 0 ] === "string" ) {
 513              return oldLoad.apply( this, arguments );
 514          }
 515  
 516          args.splice( 0, 0, name );
 517          if ( arguments.length ) {
 518              return this.bind.apply( this, args );
 519          }
 520  
 521          // Use .triggerHandler here because:
 522          // - load and unload events don't need to bubble, only applied to window or image
 523          // - error event should not bubble to window, although it does pre-1.7
 524          // See http://bugs.jquery.com/ticket/11820
 525          this.triggerHandler.apply( this, args );
 526          return this;
 527      };
 528  
 529  });
 530  
 531  jQuery.fn.toggle = function( fn, fn2 ) {
 532  
 533      // Don't mess with animation or css toggles
 534      if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
 535          return oldToggle.apply( this, arguments );
 536      }
 537      migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
 538  
 539      // Save reference to arguments for access in closure
 540      var args = arguments,
 541          guid = fn.guid || jQuery.guid++,
 542          i = 0,
 543          toggler = function( event ) {
 544              // Figure out which function to execute
 545              var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
 546              jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
 547  
 548              // Make sure that clicks stop
 549              event.preventDefault();
 550  
 551              // and execute the function
 552              return args[ lastToggle ].apply( this, arguments ) || false;
 553          };
 554  
 555      // link all the functions, so any of them can unbind this click handler
 556      toggler.guid = guid;
 557      while ( i < args.length ) {
 558          args[ i++ ].guid = guid;
 559      }
 560  
 561      return this.click( toggler );
 562  };
 563  
 564  jQuery.fn.live = function( types, data, fn ) {
 565      migrateWarn("jQuery.fn.live() is deprecated");
 566      if ( oldLive ) {
 567          return oldLive.apply( this, arguments );
 568      }
 569      jQuery( this.context ).on( types, this.selector, data, fn );
 570      return this;
 571  };
 572  
 573  jQuery.fn.die = function( types, fn ) {
 574      migrateWarn("jQuery.fn.die() is deprecated");
 575      if ( oldDie ) {
 576          return oldDie.apply( this, arguments );
 577      }
 578      jQuery( this.context ).off( types, this.selector || "**", fn );
 579      return this;
 580  };
 581  
 582  // Turn global events into document-triggered events
 583  jQuery.event.trigger = function( event, data, elem, onlyHandlers  ){
 584      if ( !elem && !rajaxEvent.test( event ) ) {
 585          migrateWarn( "Global events are undocumented and deprecated" );
 586      }
 587      return eventTrigger.call( this,  event, data, elem || document, onlyHandlers  );
 588  };
 589  jQuery.each( ajaxEvents.split("|"),
 590      function( _, name ) {
 591          jQuery.event.special[ name ] = {
 592              setup: function() {
 593                  var elem = this;
 594  
 595                  // The document needs no shimming; must be !== for oldIE
 596                  if ( elem !== document ) {
 597                      jQuery.event.add( document, name + "." + jQuery.guid, function() {
 598                          jQuery.event.trigger( name, Array.prototype.slice.call( arguments, 1 ), elem, true );
 599                      });
 600                      jQuery._data( this, name, jQuery.guid++ );
 601                  }
 602                  return false;
 603              },
 604              teardown: function() {
 605                  if ( this !== document ) {
 606                      jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
 607                  }
 608                  return false;
 609              }
 610          };
 611      }
 612  );
 613  
 614  jQuery.event.special.ready = {
 615      setup: function() { migrateWarn( "'ready' event is deprecated" ); }
 616  };
 617  
 618  var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack,
 619      oldFind = jQuery.fn.find;
 620  
 621  jQuery.fn.andSelf = function() {
 622      migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
 623      return oldSelf.apply( this, arguments );
 624  };
 625  
 626  jQuery.fn.find = function( selector ) {
 627      var ret = oldFind.apply( this, arguments );
 628      ret.context = this.context;
 629      ret.selector = this.selector ? this.selector + " " + selector : selector;
 630      return ret;
 631  };
 632  
 633  
 634  // jQuery 1.6 did not support Callbacks, do not warn there
 635  if ( jQuery.Callbacks ) {
 636  
 637      var oldDeferred = jQuery.Deferred,
 638          tuples = [
 639              // action, add listener, callbacks, .then handlers, final state
 640              [ "resolve", "done", jQuery.Callbacks("once memory"),
 641                  jQuery.Callbacks("once memory"), "resolved" ],
 642              [ "reject", "fail", jQuery.Callbacks("once memory"),
 643                  jQuery.Callbacks("once memory"), "rejected" ],
 644              [ "notify", "progress", jQuery.Callbacks("memory"),
 645                  jQuery.Callbacks("memory") ]
 646          ];
 647  
 648      jQuery.Deferred = function( func ) {
 649          var deferred = oldDeferred(),
 650              promise = deferred.promise();
 651  
 652          deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) {
 653              var fns = arguments;
 654  
 655              migrateWarn( "deferred.pipe() is deprecated" );
 656  
 657              return jQuery.Deferred(function( newDefer ) {
 658                  jQuery.each( tuples, function( i, tuple ) {
 659                      var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
 660                      // deferred.done(function() { bind to newDefer or newDefer.resolve })
 661                      // deferred.fail(function() { bind to newDefer or newDefer.reject })
 662                      // deferred.progress(function() { bind to newDefer or newDefer.notify })
 663                      deferred[ tuple[1] ](function() {
 664                          var returned = fn && fn.apply( this, arguments );
 665                          if ( returned && jQuery.isFunction( returned.promise ) ) {
 666                              returned.promise()
 667                                  .done( newDefer.resolve )
 668                                  .fail( newDefer.reject )
 669                                  .progress( newDefer.notify );
 670                          } else {
 671                              newDefer[ tuple[ 0 ] + "With" ](
 672                                  this === promise ? newDefer.promise() : this,
 673                                  fn ? [ returned ] : arguments
 674                              );
 675                          }
 676                      });
 677                  });
 678                  fns = null;
 679              }).promise();
 680  
 681          };
 682  
 683          deferred.isResolved = function() {
 684              migrateWarn( "deferred.isResolved is deprecated" );
 685              return deferred.state() === "resolved";
 686          };
 687  
 688          deferred.isRejected = function() {
 689              migrateWarn( "deferred.isRejected is deprecated" );
 690              return deferred.state() === "rejected";
 691          };
 692  
 693          if ( func ) {
 694              func.call( deferred, deferred );
 695          }
 696  
 697          return deferred;
 698      };
 699  
 700  }
 701  
 702  })( jQuery, window );