[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 /*! 2 * jQuery Migrate - v3.3.2 - 2020-11-18T08:29Z 3 * Copyright OpenJS Foundation and other contributors 4 */ 5 ( function( factory ) { 6 "use strict"; 7 8 if ( typeof define === "function" && define.amd ) { 9 10 // AMD. Register as an anonymous module. 11 define( [ "jquery" ], function( jQuery ) { 12 return factory( jQuery, window ); 13 } ); 14 } else if ( typeof module === "object" && module.exports ) { 15 16 // Node/CommonJS 17 // eslint-disable-next-line no-undef 18 module.exports = factory( require( "jquery" ), window ); 19 } else { 20 21 // Browser globals 22 factory( jQuery, window ); 23 } 24 } )( function( jQuery, window ) { 25 "use strict"; 26 27 jQuery.migrateVersion = "3.3.2"; 28 29 // Returns 0 if v1 == v2, -1 if v1 < v2, 1 if v1 > v2 30 function compareVersions( v1, v2 ) { 31 var i, 32 rVersionParts = /^(\d+)\.(\d+)\.(\d+)/, 33 v1p = rVersionParts.exec( v1 ) || [ ], 34 v2p = rVersionParts.exec( v2 ) || [ ]; 35 36 for ( i = 1; i <= 3; i++ ) { 37 if ( +v1p[ i ] > +v2p[ i ] ) { 38 return 1; 39 } 40 if ( +v1p[ i ] < +v2p[ i ] ) { 41 return -1; 42 } 43 } 44 return 0; 45 } 46 47 function jQueryVersionSince( version ) { 48 return compareVersions( jQuery.fn.jquery, version ) >= 0; 49 } 50 51 ( function() { 52 53 // Support: IE9 only 54 // IE9 only creates console object when dev tools are first opened 55 // IE9 console is a host object, callable but doesn't have .apply() 56 if ( !window.console || !window.console.log ) { 57 return; 58 } 59 60 // Need jQuery 3.0.0+ and no older Migrate loaded 61 if ( !jQuery || !jQueryVersionSince( "3.0.0" ) ) { 62 window.console.log( "JQMIGRATE: jQuery 3.0.0+ REQUIRED" ); 63 } 64 if ( jQuery.migrateWarnings ) { 65 window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" ); 66 } 67 68 // Show a message on the console so devs know we're active 69 window.console.log( "JQMIGRATE: Migrate is installed" + 70 ( jQuery.migrateMute ? "" : " with logging active" ) + 71 ", version " + jQuery.migrateVersion ); 72 73 } )(); 74 75 var warnedAbout = {}; 76 77 // By default each warning is only reported once. 78 jQuery.migrateDeduplicateWarnings = true; 79 80 // List of warnings already given; public read only 81 jQuery.migrateWarnings = []; 82 83 // Set to false to disable traces that appear with warnings 84 if ( jQuery.migrateTrace === undefined ) { 85 jQuery.migrateTrace = true; 86 } 87 88 // Forget any warnings we've already given; public 89 jQuery.migrateReset = function() { 90 warnedAbout = {}; 91 jQuery.migrateWarnings.length = 0; 92 }; 93 94 function migrateWarn( msg ) { 95 var console = window.console; 96 if ( !jQuery.migrateDeduplicateWarnings || !warnedAbout[ msg ] ) { 97 warnedAbout[ msg ] = true; 98 jQuery.migrateWarnings.push( msg ); 99 if ( console && console.warn && !jQuery.migrateMute ) { 100 console.warn( "JQMIGRATE: " + msg ); 101 if ( jQuery.migrateTrace && console.trace ) { 102 console.trace(); 103 } 104 } 105 } 106 } 107 108 function migrateWarnProp( obj, prop, value, msg ) { 109 Object.defineProperty( obj, prop, { 110 configurable: true, 111 enumerable: true, 112 get: function() { 113 migrateWarn( msg ); 114 return value; 115 }, 116 set: function( newValue ) { 117 migrateWarn( msg ); 118 value = newValue; 119 } 120 } ); 121 } 122 123 function migrateWarnFunc( obj, prop, newFunc, msg ) { 124 obj[ prop ] = function() { 125 migrateWarn( msg ); 126 return newFunc.apply( this, arguments ); 127 }; 128 } 129 130 if ( window.document.compatMode === "BackCompat" ) { 131 132 // JQuery has never supported or tested Quirks Mode 133 migrateWarn( "jQuery is not compatible with Quirks Mode" ); 134 } 135 136 var findProp, 137 class2type = {}, 138 oldInit = jQuery.fn.init, 139 oldFind = jQuery.find, 140 141 rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/, 142 rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g, 143 144 // Support: Android <=4.0 only 145 // Make sure we trim BOM and NBSP 146 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; 147 148 jQuery.fn.init = function( arg1 ) { 149 var args = Array.prototype.slice.call( arguments ); 150 151 if ( typeof arg1 === "string" && arg1 === "#" ) { 152 153 // JQuery( "#" ) is a bogus ID selector, but it returned an empty set before jQuery 3.0 154 migrateWarn( "jQuery( '#' ) is not a valid selector" ); 155 args[ 0 ] = []; 156 } 157 158 return oldInit.apply( this, args ); 159 }; 160 jQuery.fn.init.prototype = jQuery.fn; 161 162 jQuery.find = function( selector ) { 163 var args = Array.prototype.slice.call( arguments ); 164 165 // Support: PhantomJS 1.x 166 // String#match fails to match when used with a //g RegExp, only on some strings 167 if ( typeof selector === "string" && rattrHashTest.test( selector ) ) { 168 169 // The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0 170 // First see if qS thinks it's a valid selector, if so avoid a false positive 171 try { 172 window.document.querySelector( selector ); 173 } catch ( err1 ) { 174 175 // Didn't *look* valid to qSA, warn and try quoting what we think is the value 176 selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) { 177 return "[" + attr + op + "\"" + value + "\"]"; 178 } ); 179 180 // If the regexp *may* have created an invalid selector, don't update it 181 // Note that there may be false alarms if selector uses jQuery extensions 182 try { 183 window.document.querySelector( selector ); 184 migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] ); 185 args[ 0 ] = selector; 186 } catch ( err2 ) { 187 migrateWarn( "Attribute selector with '#' was not fixed: " + args[ 0 ] ); 188 } 189 } 190 } 191 192 return oldFind.apply( this, args ); 193 }; 194 195 // Copy properties attached to original jQuery.find method (e.g. .attr, .isXML) 196 for ( findProp in oldFind ) { 197 if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) { 198 jQuery.find[ findProp ] = oldFind[ findProp ]; 199 } 200 } 201 202 // The number of elements contained in the matched element set 203 migrateWarnFunc( jQuery.fn, "size", function() { 204 return this.length; 205 }, 206 "jQuery.fn.size() is deprecated and removed; use the .length property" ); 207 208 migrateWarnFunc( jQuery, "parseJSON", function() { 209 return JSON.parse.apply( null, arguments ); 210 }, 211 "jQuery.parseJSON is deprecated; use JSON.parse" ); 212 213 migrateWarnFunc( jQuery, "holdReady", jQuery.holdReady, 214 "jQuery.holdReady is deprecated" ); 215 216 migrateWarnFunc( jQuery, "unique", jQuery.uniqueSort, 217 "jQuery.unique is deprecated; use jQuery.uniqueSort" ); 218 219 // Now jQuery.expr.pseudos is the standard incantation 220 migrateWarnProp( jQuery.expr, "filters", jQuery.expr.pseudos, 221 "jQuery.expr.filters is deprecated; use jQuery.expr.pseudos" ); 222 migrateWarnProp( jQuery.expr, ":", jQuery.expr.pseudos, 223 "jQuery.expr[':'] is deprecated; use jQuery.expr.pseudos" ); 224 225 // Prior to jQuery 3.1.1 there were internal refs so we don't warn there 226 if ( jQueryVersionSince( "3.1.1" ) ) { 227 migrateWarnFunc( jQuery, "trim", function( text ) { 228 return text == null ? 229 "" : 230 ( text + "" ).replace( rtrim, "" ); 231 }, 232 "jQuery.trim is deprecated; use String.prototype.trim" ); 233 } 234 235 // Prior to jQuery 3.2 there were internal refs so we don't warn there 236 if ( jQueryVersionSince( "3.2.0" ) ) { 237 migrateWarnFunc( jQuery, "nodeName", function( elem, name ) { 238 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 239 }, 240 "jQuery.nodeName is deprecated" ); 241 242 migrateWarnFunc( jQuery, "isArray", Array.isArray, 243 "jQuery.isArray is deprecated; use Array.isArray" 244 ); 245 } 246 247 if ( jQueryVersionSince( "3.3.0" ) ) { 248 249 migrateWarnFunc( jQuery, "isNumeric", function( obj ) { 250 251 // As of jQuery 3.0, isNumeric is limited to 252 // strings and numbers (primitives or objects) 253 // that can be coerced to finite numbers (gh-2662) 254 var type = typeof obj; 255 return ( type === "number" || type === "string" ) && 256 257 // parseFloat NaNs numeric-cast false positives ("") 258 // ...but misinterprets leading-number strings, e.g. hex literals ("0x...") 259 // subtraction forces infinities to NaN 260 !isNaN( obj - parseFloat( obj ) ); 261 }, 262 "jQuery.isNumeric() is deprecated" 263 ); 264 265 // Populate the class2type map 266 jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol". 267 split( " " ), 268 function( _, name ) { 269 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 270 } ); 271 272 migrateWarnFunc( jQuery, "type", function( obj ) { 273 if ( obj == null ) { 274 return obj + ""; 275 } 276 277 // Support: Android <=2.3 only (functionish RegExp) 278 return typeof obj === "object" || typeof obj === "function" ? 279 class2type[ Object.prototype.toString.call( obj ) ] || "object" : 280 typeof obj; 281 }, 282 "jQuery.type is deprecated" ); 283 284 migrateWarnFunc( jQuery, "isFunction", 285 function( obj ) { 286 return typeof obj === "function"; 287 }, 288 "jQuery.isFunction() is deprecated" ); 289 290 migrateWarnFunc( jQuery, "isWindow", 291 function( obj ) { 292 return obj != null && obj === obj.window; 293 }, 294 "jQuery.isWindow() is deprecated" 295 ); 296 } 297 298 // Support jQuery slim which excludes the ajax module 299 if ( jQuery.ajax ) { 300 301 var oldAjax = jQuery.ajax, 302 rjsonp = /(=)\?(?=&|$)|\?\?/; 303 304 jQuery.ajax = function( ) { 305 var jQXHR = oldAjax.apply( this, arguments ); 306 307 // Be sure we got a jQXHR (e.g., not sync) 308 if ( jQXHR.promise ) { 309 migrateWarnFunc( jQXHR, "success", jQXHR.done, 310 "jQXHR.success is deprecated and removed" ); 311 migrateWarnFunc( jQXHR, "error", jQXHR.fail, 312 "jQXHR.error is deprecated and removed" ); 313 migrateWarnFunc( jQXHR, "complete", jQXHR.always, 314 "jQXHR.complete is deprecated and removed" ); 315 } 316 317 return jQXHR; 318 }; 319 320 // Only trigger the logic in jQuery <4 as the JSON-to-JSONP auto-promotion 321 // behavior is gone in jQuery 4.0 and as it has security implications, we don't 322 // want to restore the legacy behavior. 323 if ( !jQueryVersionSince( "4.0.0" ) ) { 324 325 // Register this prefilter before the jQuery one. Otherwise, a promoted 326 // request is transformed into one with the script dataType and we can't 327 // catch it anymore. 328 jQuery.ajaxPrefilter( "+json", function( s ) { 329 330 // Warn if JSON-to-JSONP auto-promotion happens. 331 if ( s.jsonp !== false && ( rjsonp.test( s.url ) || 332 typeof s.data === "string" && 333 ( s.contentType || "" ) 334 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 335 rjsonp.test( s.data ) 336 ) ) { 337 migrateWarn( "JSON-to-JSONP auto-promotion is deprecated" ); 338 } 339 } ); 340 } 341 342 } 343 344 var oldRemoveAttr = jQuery.fn.removeAttr, 345 oldToggleClass = jQuery.fn.toggleClass, 346 rmatchNonSpace = /\S+/g; 347 348 jQuery.fn.removeAttr = function( name ) { 349 var self = this; 350 351 jQuery.each( name.match( rmatchNonSpace ), function( _i, attr ) { 352 if ( jQuery.expr.match.bool.test( attr ) ) { 353 migrateWarn( "jQuery.fn.removeAttr no longer sets boolean properties: " + attr ); 354 self.prop( attr, false ); 355 } 356 } ); 357 358 return oldRemoveAttr.apply( this, arguments ); 359 }; 360 361 jQuery.fn.toggleClass = function( state ) { 362 363 // Only deprecating no-args or single boolean arg 364 if ( state !== undefined && typeof state !== "boolean" ) { 365 return oldToggleClass.apply( this, arguments ); 366 } 367 368 migrateWarn( "jQuery.fn.toggleClass( boolean ) is deprecated" ); 369 370 // Toggle entire class name of each element 371 return this.each( function() { 372 var className = this.getAttribute && this.getAttribute( "class" ) || ""; 373 374 if ( className ) { 375 jQuery.data( this, "__className__", className ); 376 } 377 378 // If the element has a class name or if we're passed `false`, 379 // then remove the whole classname (if there was one, the above saved it). 380 // Otherwise bring back whatever was previously saved (if anything), 381 // falling back to the empty string if nothing was stored. 382 if ( this.setAttribute ) { 383 this.setAttribute( "class", 384 className || state === false ? 385 "" : 386 jQuery.data( this, "__className__" ) || "" 387 ); 388 } 389 } ); 390 }; 391 392 function camelCase( string ) { 393 return string.replace( /-([a-z])/g, function( _, letter ) { 394 return letter.toUpperCase(); 395 } ); 396 } 397 398 var oldFnCss, 399 internalSwapCall = false, 400 ralphaStart = /^[a-z]/, 401 402 // The regex visualized: 403 // 404 // /----------\ 405 // | | /-------\ 406 // | / Top \ | | | 407 // /--- Border ---+-| Right |-+---+- Width -+---\ 408 // | | Bottom | | 409 // | \ Left / | 410 // | | 411 // | /----------\ | 412 // | /-------------\ | | |- END 413 // | | | | / Top \ | | 414 // | | / Margin \ | | | Right | | | 415 // |---------+-| |-+---+-| Bottom |-+----| 416 // | \ Padding / \ Left / | 417 // BEGIN -| | 418 // | /---------\ | 419 // | | | | 420 // | | / Min \ | / Width \ | 421 // \--------------+-| |-+---| |---/ 422 // \ Max / \ Height / 423 rautoPx = /^(?:Border(?:Top|Right|Bottom|Left)?(?:Width|)|(?:Margin|Padding)?(?:Top|Right|Bottom|Left)?|(?:Min|Max)?(?:Width|Height))$/; 424 425 // If this version of jQuery has .swap(), don't false-alarm on internal uses 426 if ( jQuery.swap ) { 427 jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) { 428 var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get; 429 430 if ( oldHook ) { 431 jQuery.cssHooks[ name ].get = function() { 432 var ret; 433 434 internalSwapCall = true; 435 ret = oldHook.apply( this, arguments ); 436 internalSwapCall = false; 437 return ret; 438 }; 439 } 440 } ); 441 } 442 443 jQuery.swap = function( elem, options, callback, args ) { 444 var ret, name, 445 old = {}; 446 447 if ( !internalSwapCall ) { 448 migrateWarn( "jQuery.swap() is undocumented and deprecated" ); 449 } 450 451 // Remember the old values, and insert the new ones 452 for ( name in options ) { 453 old[ name ] = elem.style[ name ]; 454 elem.style[ name ] = options[ name ]; 455 } 456 457 ret = callback.apply( elem, args || [] ); 458 459 // Revert the old values 460 for ( name in options ) { 461 elem.style[ name ] = old[ name ]; 462 } 463 464 return ret; 465 }; 466 467 if ( jQueryVersionSince( "3.4.0" ) && typeof Proxy !== "undefined" ) { 468 469 jQuery.cssProps = new Proxy( jQuery.cssProps || {}, { 470 set: function() { 471 migrateWarn( "JQMIGRATE: jQuery.cssProps is deprecated" ); 472 return Reflect.set.apply( this, arguments ); 473 } 474 } ); 475 } 476 477 // Create a dummy jQuery.cssNumber if missing. It won't be used by jQuery but 478 // it will prevent code adding new keys to it unconditionally from crashing. 479 if ( !jQuery.cssNumber ) { 480 jQuery.cssNumber = {}; 481 } 482 483 function isAutoPx( prop ) { 484 485 // The first test is used to ensure that: 486 // 1. The prop starts with a lowercase letter (as we uppercase it for the second regex). 487 // 2. The prop is not empty. 488 return ralphaStart.test( prop ) && 489 rautoPx.test( prop[ 0 ].toUpperCase() + prop.slice( 1 ) ); 490 } 491 492 oldFnCss = jQuery.fn.css; 493 494 jQuery.fn.css = function( name, value ) { 495 var camelName, 496 origThis = this; 497 if ( name && typeof name === "object" && !Array.isArray( name ) ) { 498 jQuery.each( name, function( n, v ) { 499 jQuery.fn.css.call( origThis, n, v ); 500 } ); 501 return this; 502 } 503 if ( typeof value === "number" ) { 504 camelName = camelCase( name ); 505 if ( !isAutoPx( camelName ) && !jQuery.cssNumber[ camelName ] ) { 506 migrateWarn( "Number-typed values are deprecated for jQuery.fn.css( \"" + 507 name + "\", value )" ); 508 } 509 } 510 511 return oldFnCss.apply( this, arguments ); 512 }; 513 514 var oldData = jQuery.data; 515 516 jQuery.data = function( elem, name, value ) { 517 var curData, sameKeys, key; 518 519 // Name can be an object, and each entry in the object is meant to be set as data 520 if ( name && typeof name === "object" && arguments.length === 2 ) { 521 curData = jQuery.hasData( elem ) && oldData.call( this, elem ); 522 sameKeys = {}; 523 for ( key in name ) { 524 if ( key !== camelCase( key ) ) { 525 migrateWarn( "jQuery.data() always sets/gets camelCased names: " + key ); 526 curData[ key ] = name[ key ]; 527 } else { 528 sameKeys[ key ] = name[ key ]; 529 } 530 } 531 532 oldData.call( this, elem, sameKeys ); 533 534 return name; 535 } 536 537 // If the name is transformed, look for the un-transformed name in the data object 538 if ( name && typeof name === "string" && name !== camelCase( name ) ) { 539 curData = jQuery.hasData( elem ) && oldData.call( this, elem ); 540 if ( curData && name in curData ) { 541 migrateWarn( "jQuery.data() always sets/gets camelCased names: " + name ); 542 if ( arguments.length > 2 ) { 543 curData[ name ] = value; 544 } 545 return curData[ name ]; 546 } 547 } 548 549 return oldData.apply( this, arguments ); 550 }; 551 552 // Support jQuery slim which excludes the effects module 553 if ( jQuery.fx ) { 554 555 var intervalValue, intervalMsg, 556 oldTweenRun = jQuery.Tween.prototype.run, 557 linearEasing = function( pct ) { 558 return pct; 559 }; 560 561 jQuery.Tween.prototype.run = function( ) { 562 if ( jQuery.easing[ this.easing ].length > 1 ) { 563 migrateWarn( 564 "'jQuery.easing." + this.easing.toString() + "' should use only one argument" 565 ); 566 567 jQuery.easing[ this.easing ] = linearEasing; 568 } 569 570 oldTweenRun.apply( this, arguments ); 571 }; 572 573 intervalValue = jQuery.fx.interval || 13; 574 intervalMsg = "jQuery.fx.interval is deprecated"; 575 576 // Support: IE9, Android <=4.4 577 // Avoid false positives on browsers that lack rAF 578 // Don't warn if document is hidden, jQuery uses setTimeout (#292) 579 if ( window.requestAnimationFrame ) { 580 Object.defineProperty( jQuery.fx, "interval", { 581 configurable: true, 582 enumerable: true, 583 get: function() { 584 if ( !window.document.hidden ) { 585 migrateWarn( intervalMsg ); 586 } 587 return intervalValue; 588 }, 589 set: function( newValue ) { 590 migrateWarn( intervalMsg ); 591 intervalValue = newValue; 592 } 593 } ); 594 } 595 596 } 597 598 var oldLoad = jQuery.fn.load, 599 oldEventAdd = jQuery.event.add, 600 originalFix = jQuery.event.fix; 601 602 jQuery.event.props = []; 603 jQuery.event.fixHooks = {}; 604 605 migrateWarnProp( jQuery.event.props, "concat", jQuery.event.props.concat, 606 "jQuery.event.props.concat() is deprecated and removed" ); 607 608 jQuery.event.fix = function( originalEvent ) { 609 var event, 610 type = originalEvent.type, 611 fixHook = this.fixHooks[ type ], 612 props = jQuery.event.props; 613 614 if ( props.length ) { 615 migrateWarn( "jQuery.event.props are deprecated and removed: " + props.join() ); 616 while ( props.length ) { 617 jQuery.event.addProp( props.pop() ); 618 } 619 } 620 621 if ( fixHook && !fixHook._migrated_ ) { 622 fixHook._migrated_ = true; 623 migrateWarn( "jQuery.event.fixHooks are deprecated and removed: " + type ); 624 if ( ( props = fixHook.props ) && props.length ) { 625 while ( props.length ) { 626 jQuery.event.addProp( props.pop() ); 627 } 628 } 629 } 630 631 event = originalFix.call( this, originalEvent ); 632 633 return fixHook && fixHook.filter ? fixHook.filter( event, originalEvent ) : event; 634 }; 635 636 jQuery.event.add = function( elem, types ) { 637 638 // This misses the multiple-types case but that seems awfully rare 639 if ( elem === window && types === "load" && window.document.readyState === "complete" ) { 640 migrateWarn( "jQuery(window).on('load'...) called after load event occurred" ); 641 } 642 return oldEventAdd.apply( this, arguments ); 643 }; 644 645 jQuery.each( [ "load", "unload", "error" ], function( _, name ) { 646 647 jQuery.fn[ name ] = function() { 648 var args = Array.prototype.slice.call( arguments, 0 ); 649 650 // If this is an ajax load() the first arg should be the string URL; 651 // technically this could also be the "Anything" arg of the event .load() 652 // which just goes to show why this dumb signature has been deprecated! 653 // jQuery custom builds that exclude the Ajax module justifiably die here. 654 if ( name === "load" && typeof args[ 0 ] === "string" ) { 655 return oldLoad.apply( this, args ); 656 } 657 658 migrateWarn( "jQuery.fn." + name + "() is deprecated" ); 659 660 args.splice( 0, 0, name ); 661 if ( arguments.length ) { 662 return this.on.apply( this, args ); 663 } 664 665 // Use .triggerHandler here because: 666 // - load and unload events don't need to bubble, only applied to window or image 667 // - error event should not bubble to window, although it does pre-1.7 668 // See http://bugs.jquery.com/ticket/11820 669 this.triggerHandler.apply( this, args ); 670 return this; 671 }; 672 673 } ); 674 675 jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + 676 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 677 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 678 function( _i, name ) { 679 680 // Handle event binding 681 jQuery.fn[ name ] = function( data, fn ) { 682 migrateWarn( "jQuery.fn." + name + "() event shorthand is deprecated" ); 683 return arguments.length > 0 ? 684 this.on( name, null, data, fn ) : 685 this.trigger( name ); 686 }; 687 } ); 688 689 // Trigger "ready" event only once, on document ready 690 jQuery( function() { 691 jQuery( window.document ).triggerHandler( "ready" ); 692 } ); 693 694 jQuery.event.special.ready = { 695 setup: function() { 696 if ( this === window.document ) { 697 migrateWarn( "'ready' event is deprecated" ); 698 } 699 } 700 }; 701 702 jQuery.fn.extend( { 703 704 bind: function( types, data, fn ) { 705 migrateWarn( "jQuery.fn.bind() is deprecated" ); 706 return this.on( types, null, data, fn ); 707 }, 708 unbind: function( types, fn ) { 709 migrateWarn( "jQuery.fn.unbind() is deprecated" ); 710 return this.off( types, null, fn ); 711 }, 712 delegate: function( selector, types, data, fn ) { 713 migrateWarn( "jQuery.fn.delegate() is deprecated" ); 714 return this.on( types, selector, data, fn ); 715 }, 716 undelegate: function( selector, types, fn ) { 717 migrateWarn( "jQuery.fn.undelegate() is deprecated" ); 718 return arguments.length === 1 ? 719 this.off( selector, "**" ) : 720 this.off( types, selector || "**", fn ); 721 }, 722 hover: function( fnOver, fnOut ) { 723 migrateWarn( "jQuery.fn.hover() is deprecated" ); 724 return this.on( "mouseenter", fnOver ).on( "mouseleave", fnOut || fnOver ); 725 } 726 } ); 727 728 var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, 729 origHtmlPrefilter = jQuery.htmlPrefilter, 730 makeMarkup = function( html ) { 731 var doc = window.document.implementation.createHTMLDocument( "" ); 732 doc.body.innerHTML = html; 733 return doc.body && doc.body.innerHTML; 734 }, 735 warnIfChanged = function( html ) { 736 var changed = html.replace( rxhtmlTag, "<$1></$2>" ); 737 if ( changed !== html && makeMarkup( html ) !== makeMarkup( changed ) ) { 738 migrateWarn( "HTML tags must be properly nested and closed: " + html ); 739 } 740 }; 741 742 jQuery.UNSAFE_restoreLegacyHtmlPrefilter = function() { 743 jQuery.htmlPrefilter = function( html ) { 744 warnIfChanged( html ); 745 return html.replace( rxhtmlTag, "<$1></$2>" ); 746 }; 747 }; 748 749 jQuery.htmlPrefilter = function( html ) { 750 warnIfChanged( html ); 751 return origHtmlPrefilter( html ); 752 }; 753 754 var oldOffset = jQuery.fn.offset; 755 756 jQuery.fn.offset = function() { 757 var elem = this[ 0 ]; 758 759 if ( elem && ( !elem.nodeType || !elem.getBoundingClientRect ) ) { 760 migrateWarn( "jQuery.fn.offset() requires a valid DOM element" ); 761 return arguments.length ? this : undefined; 762 } 763 764 return oldOffset.apply( this, arguments ); 765 }; 766 767 // Support jQuery slim which excludes the ajax module 768 // The jQuery.param patch is about respecting `jQuery.ajaxSettings.traditional` 769 // so it doesn't make sense for the slim build. 770 if ( jQuery.ajax ) { 771 772 var oldParam = jQuery.param; 773 774 jQuery.param = function( data, traditional ) { 775 var ajaxTraditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; 776 777 if ( traditional === undefined && ajaxTraditional ) { 778 779 migrateWarn( "jQuery.param() no longer uses jQuery.ajaxSettings.traditional" ); 780 traditional = ajaxTraditional; 781 } 782 783 return oldParam.call( this, data, traditional ); 784 }; 785 786 } 787 788 var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack; 789 790 jQuery.fn.andSelf = function() { 791 migrateWarn( "jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()" ); 792 return oldSelf.apply( this, arguments ); 793 }; 794 795 // Support jQuery slim which excludes the deferred module in jQuery 4.0+ 796 if ( jQuery.Deferred ) { 797 798 var oldDeferred = jQuery.Deferred, 799 tuples = [ 800 801 // Action, add listener, callbacks, .then handlers, final state 802 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 803 jQuery.Callbacks( "once memory" ), "resolved" ], 804 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 805 jQuery.Callbacks( "once memory" ), "rejected" ], 806 [ "notify", "progress", jQuery.Callbacks( "memory" ), 807 jQuery.Callbacks( "memory" ) ] 808 ]; 809 810 jQuery.Deferred = function( func ) { 811 var deferred = oldDeferred(), 812 promise = deferred.promise(); 813 814 deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) { 815 var fns = arguments; 816 817 migrateWarn( "deferred.pipe() is deprecated" ); 818 819 return jQuery.Deferred( function( newDefer ) { 820 jQuery.each( tuples, function( i, tuple ) { 821 var fn = typeof fns[ i ] === "function" && fns[ i ]; 822 823 // Deferred.done(function() { bind to newDefer or newDefer.resolve }) 824 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 825 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 826 deferred[ tuple[ 1 ] ]( function() { 827 var returned = fn && fn.apply( this, arguments ); 828 if ( returned && typeof returned.promise === "function" ) { 829 returned.promise() 830 .done( newDefer.resolve ) 831 .fail( newDefer.reject ) 832 .progress( newDefer.notify ); 833 } else { 834 newDefer[ tuple[ 0 ] + "With" ]( 835 this === promise ? newDefer.promise() : this, 836 fn ? [ returned ] : arguments 837 ); 838 } 839 } ); 840 } ); 841 fns = null; 842 } ).promise(); 843 844 }; 845 846 if ( func ) { 847 func.call( deferred, deferred ); 848 } 849 850 return deferred; 851 }; 852 853 // Preserve handler of uncaught exceptions in promise chains 854 jQuery.Deferred.exceptionHook = oldDeferred.exceptionHook; 855 856 } 857 858 return jQuery; 859 } );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Nov 21 01:00:03 2024 | Cross-referenced by PHPXref 0.7.1 |