├── README.md ├── component.json ├── composer.json ├── jquery-migrate.min.js └── jquery-migrate.js /README.md: -------------------------------------------------------------------------------- 1 | jQuery-migrate 2 | ============== 3 | 4 | Shim [repository](https://github.com/components/jquery-migrate) for the [jQuery-migrate](https://github.com/jquery/jquery-migrate). 5 | 6 | Package Managers 7 | ---------------- 8 | 9 | * [Component](https://github.com/component/component): `components/jquery-migrate` 10 | * [Composer](http://packagist.org/packages/components/jquery-migrate): `components/jquery-migrate` 11 | -------------------------------------------------------------------------------- /component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-migrate", 3 | "repo": "components/jquery-migrate", 4 | "version": "3.0.0", 5 | "description": "APIs and features removed from jQuery core", 6 | "license": "MIT", 7 | "keywords": [ 8 | "jquery", 9 | "javascript", 10 | "browser", 11 | "plugin", 12 | "migrate" 13 | ], 14 | "main": "jquery-migrate.js", 15 | "scripts": [ 16 | "jquery-migrate.js", 17 | "jquery-migrate.min.js" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "components/jquery-migrate", 3 | "description": "APIs and features removed from jQuery core", 4 | "type": "component", 5 | "homepage": "https://github.com/jquery/jquery-migrate", 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "jQuery Foundation and other contributors", 10 | "homepage": "https://github.com/jquery/jquery-migrate/blob/master/AUTHORS.txt" 11 | } 12 | ], 13 | "extra": { 14 | "component": { 15 | "scripts": [ 16 | "jquery-migrate.js" 17 | ], 18 | "files": [ 19 | "jquery-migrate.min.js" 20 | ] 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /jquery-migrate.min.js: -------------------------------------------------------------------------------- 1 | /*! jQuery Migrate v3.0.0 | (c) jQuery Foundation and other contributors | jquery.org/license */ 2 | "undefined"==typeof jQuery.migrateMute&&(jQuery.migrateMute=!0),function(a,b){"use strict";function c(c){var d=b.console;e[c]||(e[c]=!0,a.migrateWarnings.push(c),d&&d.warn&&!a.migrateMute&&(d.warn("JQMIGRATE: "+c),a.migrateTrace&&d.trace&&d.trace()))}function d(a,b,d,e){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){return c(e),d}})}a.migrateVersion="3.0.0",function(){var c=b.console&&b.console.log&&function(){b.console.log.apply(b.console,arguments)},d=/^[12]\./;c&&(a&&!d.test(a.fn.jquery)||c("JQMIGRATE: jQuery 3.0.0+ REQUIRED"),a.migrateWarnings&&c("JQMIGRATE: Migrate plugin loaded multiple times"),c("JQMIGRATE: Migrate is installed"+(a.migrateMute?"":" with logging active")+", version "+a.migrateVersion))}();var e={};a.migrateWarnings=[],void 0===a.migrateTrace&&(a.migrateTrace=!0),a.migrateReset=function(){e={},a.migrateWarnings.length=0},"BackCompat"===document.compatMode&&c("jQuery is not compatible with Quirks Mode");var f=a.fn.init,g=a.isNumeric,h=a.find,i=/\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,j=/\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g;a.fn.init=function(a){var b=Array.prototype.slice.call(arguments);return"string"==typeof a&&"#"===a&&(c("jQuery( '#' ) is not a valid selector"),b[0]=[]),f.apply(this,b)},a.fn.init.prototype=a.fn,a.find=function(a){var b=Array.prototype.slice.call(arguments);if("string"==typeof a&&i.test(a))try{document.querySelector(a)}catch(d){a=a.replace(j,function(a,b,c,d){return"["+b+c+'"'+d+'"]'});try{document.querySelector(a),c("Attribute selector with '#' must be quoted: "+b[0]),b[0]=a}catch(e){c("Attribute selector with '#' was not fixed: "+b[0])}}return h.apply(this,b)};var k;for(k in h)Object.prototype.hasOwnProperty.call(h,k)&&(a.find[k]=h[k]);a.fn.size=function(){return c("jQuery.fn.size() is deprecated; use the .length property"),this.length},a.parseJSON=function(){return c("jQuery.parseJSON is deprecated; use JSON.parse"),JSON.parse.apply(null,arguments)},a.isNumeric=function(b){function d(b){var c=b&&b.toString();return!a.isArray(b)&&c-parseFloat(c)+1>=0}var e=g(b),f=d(b);return e!==f&&c("jQuery.isNumeric() should not be called on constructed objects"),f},d(a,"unique",a.uniqueSort,"jQuery.unique is deprecated, use jQuery.uniqueSort"),d(a.expr,"filters",a.expr.pseudos,"jQuery.expr.filters is now jQuery.expr.pseudos"),d(a.expr,":",a.expr.pseudos,'jQuery.expr[":"] is now jQuery.expr.pseudos');var l=a.ajax;a.ajax=function(){var a=l.apply(this,arguments);return a.promise&&(d(a,"success",a.done,"jQXHR.success is deprecated and removed"),d(a,"error",a.fail,"jQXHR.error is deprecated and removed"),d(a,"complete",a.always,"jQXHR.complete is deprecated and removed")),a};var m=a.fn.removeAttr,n=a.fn.toggleClass,o=/\S+/g;a.fn.removeAttr=function(b){var d=this;return a.each(b.match(o),function(b,e){a.expr.match.bool.test(e)&&(c("jQuery.fn.removeAttr no longer sets boolean properties: "+e),d.prop(e,!1))}),m.apply(this,arguments)},a.fn.toggleClass=function(b){return void 0!==b&&"boolean"!=typeof b?n.apply(this,arguments):(c("jQuery.fn.toggleClass( boolean ) is deprecated"),this.each(function(){var c=this.getAttribute&&this.getAttribute("class")||"";c&&a.data(this,"__className__",c),this.setAttribute&&this.setAttribute("class",c||b===!1?"":a.data(this,"__className__")||"")}))};var p=!1;a.swap&&a.each(["height","width","reliableMarginRight"],function(b,c){var d=a.cssHooks[c]&&a.cssHooks[c].get;d&&(a.cssHooks[c].get=function(){var a;return p=!0,a=d.apply(this,arguments),p=!1,a})}),a.swap=function(a,b,d,e){var f,g,h={};p||c("jQuery.swap() is undocumented and deprecated");for(g in b)h[g]=a.style[g],a.style[g]=b[g];f=d.apply(a,e||[]);for(g in b)a.style[g]=h[g];return f};var q=a.data;a.data=function(b,d,e){var f;return d&&d!==a.camelCase(d)&&(f=a.hasData(b)&&q.call(this,b),f&&d in f)?(c("jQuery.data() always sets/gets camelCased names: "+d),arguments.length>2&&(f[d]=e),f[d]):q.apply(this,arguments)};var r=a.Tween.prototype.run;a.Tween.prototype.run=function(b){a.easing[this.easing].length>1&&(c('easing function "jQuery.easing.'+this.easing.toString()+'" should use only first argument'),a.easing[this.easing]=a.easing[this.easing].bind(a.easing,b,this.options.duration*b,0,1,this.options.duration)),r.apply(this,arguments)};var s=a.fn.load,t=a.event.fix;a.event.props=[],a.event.fixHooks={},a.event.fix=function(b){var d,e=b.type,f=this.fixHooks[e],g=a.event.props;if(g.length)for(c("jQuery.event.props are deprecated and removed: "+g.join());g.length;)a.event.addProp(g.pop());if(f&&!f._migrated_&&(f._migrated_=!0,c("jQuery.event.fixHooks are deprecated and removed: "+e),(g=f.props)&&g.length))for(;g.length;)a.event.addProp(g.pop());return d=t.call(this,b),f&&f.filter?f.filter(d,b):d},a.each(["load","unload","error"],function(b,d){a.fn[d]=function(){var a=Array.prototype.slice.call(arguments,0);return"load"===d&&"string"==typeof a[0]?s.apply(this,a):(c("jQuery.fn."+d+"() is deprecated"),a.splice(0,0,d),arguments.length?this.on.apply(this,a):(this.triggerHandler.apply(this,a),this))}}),a(function(){a(document).triggerHandler("ready")}),a.event.special.ready={setup:function(){this===document&&c("'ready' event is deprecated")}},a.fn.extend({bind:function(a,b,d){return c("jQuery.fn.bind() is deprecated"),this.on(a,null,b,d)},unbind:function(a,b){return c("jQuery.fn.unbind() is deprecated"),this.off(a,null,b)},delegate:function(a,b,d,e){return c("jQuery.fn.delegate() is deprecated"),this.on(b,a,d,e)},undelegate:function(a,b,d){return c("jQuery.fn.undelegate() is deprecated"),1===arguments.length?this.off(a,"**"):this.off(b,a||"**",d)}});var u=a.fn.offset;a.fn.offset=function(){var b,d=this[0],e={top:0,left:0};return d&&d.nodeType?(b=(d.ownerDocument||document).documentElement,a.contains(b,d)?u.apply(this,arguments):(c("jQuery.fn.offset() requires an element connected to a document"),e)):(c("jQuery.fn.offset() requires a valid DOM element"),e)};var v=a.param;a.param=function(b,d){var e=a.ajaxSettings&&a.ajaxSettings.traditional;return void 0===d&&e&&(c("jQuery.param() no longer uses jQuery.ajaxSettings.traditional"),d=e),v.call(this,b,d)};var w=a.fn.andSelf||a.fn.addBack;a.fn.andSelf=function(){return c("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"),w.apply(this,arguments)};var x=a.Deferred,y=[["resolve","done",a.Callbacks("once memory"),a.Callbacks("once memory"),"resolved"],["reject","fail",a.Callbacks("once memory"),a.Callbacks("once memory"),"rejected"],["notify","progress",a.Callbacks("memory"),a.Callbacks("memory")]];a.Deferred=function(b){var d=x(),e=d.promise();return d.pipe=e.pipe=function(){var b=arguments;return c("deferred.pipe() is deprecated"),a.Deferred(function(c){a.each(y,function(f,g){var h=a.isFunction(b[f])&&b[f];d[g[1]](function(){var b=h&&h.apply(this,arguments);b&&a.isFunction(b.promise)?b.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[g[0]+"With"](this===e?c.promise():this,h?[b]:arguments)})}),b=null}).promise()},b&&b.call(d,d),d}}(jQuery,window); -------------------------------------------------------------------------------- /jquery-migrate.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery Migrate - v3.0.0 - 2016-06-09 3 | * Copyright jQuery Foundation and other contributors 4 | */ 5 | (function( jQuery, window ) { 6 | "use strict"; 7 | 8 | 9 | jQuery.migrateVersion = "3.0.0"; 10 | 11 | 12 | ( function() { 13 | 14 | // Support: IE9 only 15 | // IE9 only creates console object when dev tools are first opened 16 | // Also, avoid Function#bind here to simplify PhantomJS usage 17 | var log = window.console && window.console.log && 18 | function() { window.console.log.apply( window.console, arguments ); }, 19 | rbadVersions = /^[12]\./; 20 | 21 | if ( !log ) { 22 | return; 23 | } 24 | 25 | // Need jQuery 3.0.0+ and no older Migrate loaded 26 | if ( !jQuery || rbadVersions.test( jQuery.fn.jquery ) ) { 27 | log( "JQMIGRATE: jQuery 3.0.0+ REQUIRED" ); 28 | } 29 | if ( jQuery.migrateWarnings ) { 30 | log( "JQMIGRATE: Migrate plugin loaded multiple times" ); 31 | } 32 | 33 | // Show a message on the console so devs know we're active 34 | log( "JQMIGRATE: Migrate is installed" + 35 | ( jQuery.migrateMute ? "" : " with logging active" ) + 36 | ", version " + jQuery.migrateVersion ); 37 | 38 | } )(); 39 | 40 | var warnedAbout = {}; 41 | 42 | // List of warnings already given; public read only 43 | jQuery.migrateWarnings = []; 44 | 45 | // Set to false to disable traces that appear with warnings 46 | if ( jQuery.migrateTrace === undefined ) { 47 | jQuery.migrateTrace = true; 48 | } 49 | 50 | // Forget any warnings we've already given; public 51 | jQuery.migrateReset = function() { 52 | warnedAbout = {}; 53 | jQuery.migrateWarnings.length = 0; 54 | }; 55 | 56 | function migrateWarn( msg ) { 57 | var console = window.console; 58 | if ( !warnedAbout[ msg ] ) { 59 | warnedAbout[ msg ] = true; 60 | jQuery.migrateWarnings.push( msg ); 61 | if ( console && console.warn && !jQuery.migrateMute ) { 62 | console.warn( "JQMIGRATE: " + msg ); 63 | if ( jQuery.migrateTrace && console.trace ) { 64 | console.trace(); 65 | } 66 | } 67 | } 68 | } 69 | 70 | function migrateWarnProp( obj, prop, value, msg ) { 71 | Object.defineProperty( obj, prop, { 72 | configurable: true, 73 | enumerable: true, 74 | get: function() { 75 | migrateWarn( msg ); 76 | return value; 77 | } 78 | } ); 79 | } 80 | 81 | if ( document.compatMode === "BackCompat" ) { 82 | 83 | // JQuery has never supported or tested Quirks Mode 84 | migrateWarn( "jQuery is not compatible with Quirks Mode" ); 85 | } 86 | 87 | 88 | var oldInit = jQuery.fn.init, 89 | oldIsNumeric = jQuery.isNumeric, 90 | oldFind = jQuery.find, 91 | rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/, 92 | rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g; 93 | 94 | jQuery.fn.init = function( arg1 ) { 95 | var args = Array.prototype.slice.call( arguments ); 96 | 97 | if ( typeof arg1 === "string" && arg1 === "#" ) { 98 | 99 | // JQuery( "#" ) is a bogus ID selector, but it returned an empty set before jQuery 3.0 100 | migrateWarn( "jQuery( '#' ) is not a valid selector" ); 101 | args[ 0 ] = []; 102 | } 103 | 104 | return oldInit.apply( this, args ); 105 | }; 106 | jQuery.fn.init.prototype = jQuery.fn; 107 | 108 | jQuery.find = function( selector ) { 109 | var args = Array.prototype.slice.call( arguments ); 110 | 111 | // Support: PhantomJS 1.x 112 | // String#match fails to match when used with a //g RegExp, only on some strings 113 | if ( typeof selector === "string" && rattrHashTest.test( selector ) ) { 114 | 115 | // The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0 116 | // First see if qS thinks it's a valid selector, if so avoid a false positive 117 | try { 118 | document.querySelector( selector ); 119 | } catch ( err1 ) { 120 | 121 | // Didn't *look* valid to qSA, warn and try quoting what we think is the value 122 | selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) { 123 | return "[" + attr + op + "\"" + value + "\"]"; 124 | } ); 125 | 126 | // If the regexp *may* have created an invalid selector, don't update it 127 | // Note that there may be false alarms if selector uses jQuery extensions 128 | try { 129 | document.querySelector( selector ); 130 | migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] ); 131 | args[ 0 ] = selector; 132 | } catch ( err2 ) { 133 | migrateWarn( "Attribute selector with '#' was not fixed: " + args[ 0 ] ); 134 | } 135 | } 136 | } 137 | 138 | return oldFind.apply( this, args ); 139 | }; 140 | 141 | // Copy properties attached to original jQuery.find method (e.g. .attr, .isXML) 142 | var findProp; 143 | for ( findProp in oldFind ) { 144 | if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) { 145 | jQuery.find[ findProp ] = oldFind[ findProp ]; 146 | } 147 | } 148 | 149 | // The number of elements contained in the matched element set 150 | jQuery.fn.size = function() { 151 | migrateWarn( "jQuery.fn.size() is deprecated; use the .length property" ); 152 | return this.length; 153 | }; 154 | 155 | jQuery.parseJSON = function() { 156 | migrateWarn( "jQuery.parseJSON is deprecated; use JSON.parse" ); 157 | return JSON.parse.apply( null, arguments ); 158 | }; 159 | 160 | jQuery.isNumeric = function( val ) { 161 | 162 | // The jQuery 2.2.3 implementation of isNumeric 163 | function isNumeric2( obj ) { 164 | var realStringObj = obj && obj.toString(); 165 | return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0; 166 | } 167 | 168 | var newValue = oldIsNumeric( val ), 169 | oldValue = isNumeric2( val ); 170 | 171 | if ( newValue !== oldValue ) { 172 | migrateWarn( "jQuery.isNumeric() should not be called on constructed objects" ); 173 | } 174 | 175 | return oldValue; 176 | }; 177 | 178 | migrateWarnProp( jQuery, "unique", jQuery.uniqueSort, 179 | "jQuery.unique is deprecated, use jQuery.uniqueSort" ); 180 | 181 | // Now jQuery.expr.pseudos is the standard incantation 182 | migrateWarnProp( jQuery.expr, "filters", jQuery.expr.pseudos, 183 | "jQuery.expr.filters is now jQuery.expr.pseudos" ); 184 | migrateWarnProp( jQuery.expr, ":", jQuery.expr.pseudos, 185 | "jQuery.expr[\":\"] is now jQuery.expr.pseudos" ); 186 | 187 | 188 | var oldAjax = jQuery.ajax; 189 | 190 | jQuery.ajax = function( ) { 191 | var jQXHR = oldAjax.apply( this, arguments ); 192 | 193 | // Be sure we got a jQXHR (e.g., not sync) 194 | if ( jQXHR.promise ) { 195 | migrateWarnProp( jQXHR, "success", jQXHR.done, 196 | "jQXHR.success is deprecated and removed" ); 197 | migrateWarnProp( jQXHR, "error", jQXHR.fail, 198 | "jQXHR.error is deprecated and removed" ); 199 | migrateWarnProp( jQXHR, "complete", jQXHR.always, 200 | "jQXHR.complete is deprecated and removed" ); 201 | } 202 | 203 | return jQXHR; 204 | }; 205 | 206 | 207 | var oldRemoveAttr = jQuery.fn.removeAttr, 208 | oldToggleClass = jQuery.fn.toggleClass, 209 | rmatchNonSpace = /\S+/g; 210 | 211 | jQuery.fn.removeAttr = function( name ) { 212 | var self = this; 213 | 214 | jQuery.each( name.match( rmatchNonSpace ), function( i, attr ) { 215 | if ( jQuery.expr.match.bool.test( attr ) ) { 216 | migrateWarn( "jQuery.fn.removeAttr no longer sets boolean properties: " + attr ); 217 | self.prop( attr, false ); 218 | } 219 | } ); 220 | 221 | return oldRemoveAttr.apply( this, arguments ); 222 | }; 223 | 224 | jQuery.fn.toggleClass = function( state ) { 225 | 226 | // Only deprecating no-args or single boolean arg 227 | if ( state !== undefined && typeof state !== "boolean" ) { 228 | return oldToggleClass.apply( this, arguments ); 229 | } 230 | 231 | migrateWarn( "jQuery.fn.toggleClass( boolean ) is deprecated" ); 232 | 233 | // Toggle entire class name of each element 234 | return this.each( function() { 235 | var className = this.getAttribute && this.getAttribute( "class" ) || ""; 236 | 237 | if ( className ) { 238 | jQuery.data( this, "__className__", className ); 239 | } 240 | 241 | // If the element has a class name or if we're passed `false`, 242 | // then remove the whole classname (if there was one, the above saved it). 243 | // Otherwise bring back whatever was previously saved (if anything), 244 | // falling back to the empty string if nothing was stored. 245 | if ( this.setAttribute ) { 246 | this.setAttribute( "class", 247 | className || state === false ? 248 | "" : 249 | jQuery.data( this, "__className__" ) || "" 250 | ); 251 | } 252 | } ); 253 | }; 254 | 255 | 256 | var internalSwapCall = false; 257 | 258 | // If this version of jQuery has .swap(), don't false-alarm on internal uses 259 | if ( jQuery.swap ) { 260 | jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) { 261 | var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get; 262 | 263 | if ( oldHook ) { 264 | jQuery.cssHooks[ name ].get = function() { 265 | var ret; 266 | 267 | internalSwapCall = true; 268 | ret = oldHook.apply( this, arguments ); 269 | internalSwapCall = false; 270 | return ret; 271 | }; 272 | } 273 | } ); 274 | } 275 | 276 | jQuery.swap = function( elem, options, callback, args ) { 277 | var ret, name, 278 | old = {}; 279 | 280 | if ( !internalSwapCall ) { 281 | migrateWarn( "jQuery.swap() is undocumented and deprecated" ); 282 | } 283 | 284 | // Remember the old values, and insert the new ones 285 | for ( name in options ) { 286 | old[ name ] = elem.style[ name ]; 287 | elem.style[ name ] = options[ name ]; 288 | } 289 | 290 | ret = callback.apply( elem, args || [] ); 291 | 292 | // Revert the old values 293 | for ( name in options ) { 294 | elem.style[ name ] = old[ name ]; 295 | } 296 | 297 | return ret; 298 | }; 299 | 300 | var oldData = jQuery.data; 301 | 302 | jQuery.data = function( elem, name, value ) { 303 | var curData; 304 | 305 | // If the name is transformed, look for the un-transformed name in the data object 306 | if ( name && name !== jQuery.camelCase( name ) ) { 307 | curData = jQuery.hasData( elem ) && oldData.call( this, elem ); 308 | if ( curData && name in curData ) { 309 | migrateWarn( "jQuery.data() always sets/gets camelCased names: " + name ); 310 | if ( arguments.length > 2 ) { 311 | curData[ name ] = value; 312 | } 313 | return curData[ name ]; 314 | } 315 | } 316 | 317 | return oldData.apply( this, arguments ); 318 | }; 319 | 320 | var oldTweenRun = jQuery.Tween.prototype.run; 321 | 322 | jQuery.Tween.prototype.run = function( percent ) { 323 | if ( jQuery.easing[ this.easing ].length > 1 ) { 324 | migrateWarn( 325 | "easing function " + 326 | "\"jQuery.easing." + this.easing.toString() + 327 | "\" should use only first argument" 328 | ); 329 | 330 | jQuery.easing[ this.easing ] = jQuery.easing[ this.easing ].bind( 331 | jQuery.easing, 332 | percent, this.options.duration * percent, 0, 1, this.options.duration 333 | ); 334 | } 335 | 336 | oldTweenRun.apply( this, arguments ); 337 | }; 338 | 339 | var oldLoad = jQuery.fn.load, 340 | originalFix = jQuery.event.fix; 341 | 342 | jQuery.event.props = []; 343 | jQuery.event.fixHooks = {}; 344 | 345 | jQuery.event.fix = function( originalEvent ) { 346 | var event, 347 | type = originalEvent.type, 348 | fixHook = this.fixHooks[ type ], 349 | props = jQuery.event.props; 350 | 351 | if ( props.length ) { 352 | migrateWarn( "jQuery.event.props are deprecated and removed: " + props.join() ); 353 | while ( props.length ) { 354 | jQuery.event.addProp( props.pop() ); 355 | } 356 | } 357 | 358 | if ( fixHook && !fixHook._migrated_ ) { 359 | fixHook._migrated_ = true; 360 | migrateWarn( "jQuery.event.fixHooks are deprecated and removed: " + type ); 361 | if ( ( props = fixHook.props ) && props.length ) { 362 | while ( props.length ) { 363 | jQuery.event.addProp( props.pop() ); 364 | } 365 | } 366 | } 367 | 368 | event = originalFix.call( this, originalEvent ); 369 | 370 | return fixHook && fixHook.filter ? fixHook.filter( event, originalEvent ) : event; 371 | }; 372 | 373 | jQuery.each( [ "load", "unload", "error" ], function( _, name ) { 374 | 375 | jQuery.fn[ name ] = function() { 376 | var args = Array.prototype.slice.call( arguments, 0 ); 377 | 378 | // If this is an ajax load() the first arg should be the string URL; 379 | // technically this could also be the "Anything" arg of the event .load() 380 | // which just goes to show why this dumb signature has been deprecated! 381 | // jQuery custom builds that exclude the Ajax module justifiably die here. 382 | if ( name === "load" && typeof args[ 0 ] === "string" ) { 383 | return oldLoad.apply( this, args ); 384 | } 385 | 386 | migrateWarn( "jQuery.fn." + name + "() is deprecated" ); 387 | 388 | args.splice( 0, 0, name ); 389 | if ( arguments.length ) { 390 | return this.on.apply( this, args ); 391 | } 392 | 393 | // Use .triggerHandler here because: 394 | // - load and unload events don't need to bubble, only applied to window or image 395 | // - error event should not bubble to window, although it does pre-1.7 396 | // See http://bugs.jquery.com/ticket/11820 397 | this.triggerHandler.apply( this, args ); 398 | return this; 399 | }; 400 | 401 | } ); 402 | 403 | // Trigger "ready" event only once, on document ready 404 | jQuery( function() { 405 | jQuery( document ).triggerHandler( "ready" ); 406 | } ); 407 | 408 | jQuery.event.special.ready = { 409 | setup: function() { 410 | if ( this === document ) { 411 | migrateWarn( "'ready' event is deprecated" ); 412 | } 413 | } 414 | }; 415 | 416 | jQuery.fn.extend( { 417 | 418 | bind: function( types, data, fn ) { 419 | migrateWarn( "jQuery.fn.bind() is deprecated" ); 420 | return this.on( types, null, data, fn ); 421 | }, 422 | unbind: function( types, fn ) { 423 | migrateWarn( "jQuery.fn.unbind() is deprecated" ); 424 | return this.off( types, null, fn ); 425 | }, 426 | delegate: function( selector, types, data, fn ) { 427 | migrateWarn( "jQuery.fn.delegate() is deprecated" ); 428 | return this.on( types, selector, data, fn ); 429 | }, 430 | undelegate: function( selector, types, fn ) { 431 | migrateWarn( "jQuery.fn.undelegate() is deprecated" ); 432 | return arguments.length === 1 ? 433 | this.off( selector, "**" ) : 434 | this.off( types, selector || "**", fn ); 435 | } 436 | } ); 437 | 438 | 439 | var oldOffset = jQuery.fn.offset; 440 | 441 | jQuery.fn.offset = function() { 442 | var docElem, 443 | elem = this[ 0 ], 444 | origin = { top: 0, left: 0 }; 445 | 446 | if ( !elem || !elem.nodeType ) { 447 | migrateWarn( "jQuery.fn.offset() requires a valid DOM element" ); 448 | return origin; 449 | } 450 | 451 | docElem = ( elem.ownerDocument || document ).documentElement; 452 | if ( !jQuery.contains( docElem, elem ) ) { 453 | migrateWarn( "jQuery.fn.offset() requires an element connected to a document" ); 454 | return origin; 455 | } 456 | 457 | return oldOffset.apply( this, arguments ); 458 | }; 459 | 460 | 461 | var oldParam = jQuery.param; 462 | 463 | jQuery.param = function( data, traditional ) { 464 | var ajaxTraditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; 465 | 466 | if ( traditional === undefined && ajaxTraditional ) { 467 | 468 | migrateWarn( "jQuery.param() no longer uses jQuery.ajaxSettings.traditional" ); 469 | traditional = ajaxTraditional; 470 | } 471 | 472 | return oldParam.call( this, data, traditional ); 473 | }; 474 | 475 | var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack; 476 | 477 | jQuery.fn.andSelf = function() { 478 | migrateWarn( "jQuery.fn.andSelf() replaced by jQuery.fn.addBack()" ); 479 | return oldSelf.apply( this, arguments ); 480 | }; 481 | 482 | 483 | var oldDeferred = jQuery.Deferred, 484 | tuples = [ 485 | 486 | // Action, add listener, callbacks, .then handlers, final state 487 | [ "resolve", "done", jQuery.Callbacks( "once memory" ), 488 | jQuery.Callbacks( "once memory" ), "resolved" ], 489 | [ "reject", "fail", jQuery.Callbacks( "once memory" ), 490 | jQuery.Callbacks( "once memory" ), "rejected" ], 491 | [ "notify", "progress", jQuery.Callbacks( "memory" ), 492 | jQuery.Callbacks( "memory" ) ] 493 | ]; 494 | 495 | jQuery.Deferred = function( func ) { 496 | var deferred = oldDeferred(), 497 | promise = deferred.promise(); 498 | 499 | deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) { 500 | var fns = arguments; 501 | 502 | migrateWarn( "deferred.pipe() is deprecated" ); 503 | 504 | return jQuery.Deferred( function( newDefer ) { 505 | jQuery.each( tuples, function( i, tuple ) { 506 | var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; 507 | 508 | // Deferred.done(function() { bind to newDefer or newDefer.resolve }) 509 | // deferred.fail(function() { bind to newDefer or newDefer.reject }) 510 | // deferred.progress(function() { bind to newDefer or newDefer.notify }) 511 | deferred[ tuple[ 1 ] ]( function() { 512 | var returned = fn && fn.apply( this, arguments ); 513 | if ( returned && jQuery.isFunction( returned.promise ) ) { 514 | returned.promise() 515 | .done( newDefer.resolve ) 516 | .fail( newDefer.reject ) 517 | .progress( newDefer.notify ); 518 | } else { 519 | newDefer[ tuple[ 0 ] + "With" ]( 520 | this === promise ? newDefer.promise() : this, 521 | fn ? [ returned ] : arguments 522 | ); 523 | } 524 | } ); 525 | } ); 526 | fns = null; 527 | } ).promise(); 528 | 529 | }; 530 | 531 | if ( func ) { 532 | func.call( deferred, deferred ); 533 | } 534 | 535 | return deferred; 536 | }; 537 | 538 | 539 | 540 | })( jQuery, window ); 541 | --------------------------------------------------------------------------------