1/*! 2 * jQuery Migrate - v1.4.1 - 2016-05-19 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 10jQuery.migrateVersion = "1.4.1"; 11 12 13var warnedAbout = {}; 14 15// List of warnings already given; public read only 16jQuery.migrateWarnings = []; 17 18// Set to true to prevent console output; migrateWarnings still maintained 19// jQuery.migrateMute = false; 20 21// Console output is controlled by the platform: silent in production, active elsewhere. 22// Warnings are reported to Datadog regardless of this setting. 23if ( jQuery.migrateMute === undefined ) { 24 jQuery.migrateMute = !!window.MC_JQMIGRATE_MUTE; 25} 26 27// Show a message on the console so devs know we're active 28if ( window.console && window.console.log && !jQuery.migrateMute ) { 29 window.console.log( "JQMIGRATE: Migrate is installed with logging active, version " + 30 jQuery.migrateVersion ); 31} 32 33// Set to false to disable traces that appear with warnings 34if ( jQuery.migrateTrace === undefined ) { 35 jQuery.migrateTrace = true; 36} 37 38// Forget any warnings we've already given; public 39jQuery.migrateReset = function() { 40 warnedAbout = {}; 41 jQuery.migrateWarnings.length = 0; 42}; 43 44function migrateWarn( msg) { 45 var console = window.console; 46 47 // Reported ahead of the dedupe below rather than inside it. Migrate dedupes on the 48 // message alone, so every call site after the first would never be seen - and the call 49 // site is the whole point. The reporter dedupes on message plus origin instead, and 50 // caps how many times it will parse a stack for one message on a single pageview. 51 // 52 // console.trace() is not captured by the Datadog browser SDK, so the synthesized Error 53 // is the only way the call site reaches us. 54 // migrateWants is a cheap budget check, asked first so a deprecated call in a hot loop - 55 // $.browser read from a mousemove handler, .attr() across a large grid - does not pay to 56 // capture a stack that the reporter would immediately discard. 57 if ( window.MCJSErrorReporting && MCJSErrorReporting.migrateWarning && 58 ( !MCJSErrorReporting.migrateWants || MCJSErrorReporting.migrateWants( msg ) ) ) { 59 60 // V8 keeps only 10 frames by default, and a deprecation reached through jQuery 61 // internals can fill all ten with frames the reporter skips, leaving it no call site. 62 // finally, not a trailing restore: if anything above threw, leaving the limit raised 63 // would quietly make every later error on the page more expensive with no visible cause. 64 var stackLimit = Error.stackTraceLimit; 65 var widen = typeof stackLimit === "number" && stackLimit < 30; 66 try { 67 if ( widen ) { 68 Error.stackTraceLimit = 30; 69 } 70 MCJSErrorReporting.migrateWarning( msg, new Error( "JQMIGRATE: " + msg ) ); 71 } finally { 72 if ( widen ) { 73 Error.stackTraceLimit = stackLimit; 74 } 75 } 76 } 77 78 if ( !warnedAbout[ msg ] ) { 79 warnedAbout[ msg ] = true; 80 jQuery.migrateWarnings.push( msg ); 81 82 if ( console && console.warn && !jQuery.migrateMute ) { 83 console.warn( "JQMIGRATE: " + msg ); 84 if ( jQuery.migrateTrace && console.trace ) { 85 console.trace(); 86 } 87 } 88 } 89} 90 91function migrateWarnProp( obj, prop, value, msg ) { 92 if ( Object.defineProperty ) { 93 // On ES5 browsers (non-oldIE), warn if the code tries to get prop; 94 // allow property to be overwritten in case some other plugin wants it 95 try { 96 Object.defineProperty( obj, prop, { 97 configurable: true, 98 enumerable: true, 99 get: function() { 100 migrateWarn( msg ); 101 return value; 102 }, 103 set: function( newValue ) { 104 migrateWarn( msg ); 105 value = newValue; 106 } 107 }); 108 return; 109 } catch( err ) { 110 // IE8 is a dope about Object.defineProperty, can't warn there 111 } 112 } 113 114 // Non-ES5 (or broken) browser; just set the property 115 jQuery._definePropertyBroken = true; 116 obj[ prop ] = value; 117} 118 119if ( document.compatMode === "BackCompat" ) { 120 // jQuery has never supported or tested Quirks Mode 121 migrateWarn( "jQuery is not compatible with Quirks Mode" ); 122} 123 124 125var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn, 126 oldAttr = jQuery.attr, 127 valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get || 128 function() { return null; }, 129 valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set || 130 function() { return undefined; }, 131 rnoType = /^(?:input|button)$/i, 132 rnoAttrNodeType = /^[238]$/, 133 rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, 134 ruseDefault = /^(?:checked|selected)$/i; 135 136// jQuery.attrFn 137migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" ); 138 139jQuery.attr = function( elem, name, value, pass ) { 140 var lowerName = name.toLowerCase(), 141 nType = elem && elem.nodeType; 142 143 if ( pass ) { 144 // Since pass is used internally, we only warn for new jQuery 145 // versions where there isn't a pass arg in the formal params 146 if ( oldAttr.length < 4 ) { 147 migrateWarn("jQuery.fn.attr( props, pass ) is deprecated"); 148 } 149 if ( elem && !rnoAttrNodeType.test( nType ) && 150 (attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) { 151 return jQuery( elem )[ name ]( value ); 152 } 153 } 154 155 // Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking 156 // for disconnected elements we don't warn on $( "<button>", { type: "button" } ). 157 if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) { 158 migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8"); 159 } 160 161 // Restore boolHook for boolean property/attribute synchronization 162 if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) { 163 jQuery.attrHooks[ lowerName ] = { 164 get: function( elem, name ) { 165 // Align boolean attributes with corresponding properties 166 // Fall back to attribute presence where some booleans are not supported 167 var attrNode, 168 property = jQuery.prop( elem, name ); 169 return property === true || typeof property !== "boolean" && 170 ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? 171 172 name.toLowerCase() : 173 undefined; 174 },
175 set: function( elem, value, name ) { 176 var propName; 177 if ( value === false ) { 178 // Remove boolean attributes when set to false 179 jQuery.removeAttr( elem, name ); 180 } else { 181 // value is true since we know at this point it's type boolean and not false 182 // Set boolean attributes to the same name and set the DOM property 183 propName = jQuery.propFix[ name ] || name; 184 if ( propName in elem ) { 185 // Only set the IDL specifically if it already exists on the element 186 elem[ propName ] = true; 187 } 188 189 elem.setAttribute( name, name.toLowerCase() ); 190 } 191 return name; 192 } 193 }; 194 195 // Warn only for attributes that can remain distinct from their properties post-1.9 196 if ( ruseDefault.test( lowerName ) ) { 197 migrateWarn( "jQuery.fn.attr('" + lowerName + "') might use property instead of attribute" ); 198 } 199 } 200 201 return oldAttr.call( jQuery, elem, name, value ); 202}; 203 204// attrHooks: value 205jQuery.attrHooks.value = { 206 get: function( elem, name ) { 207 var nodeName = ( elem.nodeName || "" ).toLowerCase(); 208 if ( nodeName === "button" ) { 209 return valueAttrGet.apply( this, arguments ); 210 } 211 if ( nodeName !== "input" && nodeName !== "option" ) { 212 migrateWarn("jQuery.fn.attr('value') no longer gets properties"); 213 } 214 return name in elem ? 215 elem.value : 216 null; 217 }, 218 set: function( elem, value ) { 219 var nodeName = ( elem.nodeName || "" ).toLowerCase(); 220 if ( nodeName === "button" ) { 221 return valueAttrSet.apply( this, arguments ); 222 } 223 if ( nodeName !== "input" && nodeName !== "option" ) { 224 migrateWarn("jQuery.fn.attr('value', val) no longer sets properties"); 225 } 226 // Does not return so that setAttribute is also used 227 elem.value = value; 228 } 229}; 230 231 232var matched, browser, 233 oldInit = jQuery.fn.init, 234 oldFind = jQuery.find, 235 oldParseJSON = jQuery.parseJSON, 236 rspaceAngle = /^\s*</, 237 rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/, 238 rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g, 239 // Note: XSS check is done below after string is trimmed 240 rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/; 241 242// $(html) "looks like html" rule change 243jQuery.fn.init = function( selector, context, rootjQuery ) { 244 var match, ret; 245 246 if ( selector && typeof selector === "string" ) { 247 if ( !jQuery.isPlainObject( context ) && 248 (match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) { 249 250 // This is an HTML string according to the "old" rules; is it still? 251 if ( !rspaceAngle.test( selector ) ) { 252 migrateWarn("$(html) HTML strings must start with '<' character"); 253 } 254 if ( match[ 3 ] ) { 255 migrateWarn("$(html) HTML text after last tag is ignored"); 256 } 257 258 // Consistently reject any HTML-like string starting with a hash (gh-9521) 259 // Note that this may break jQuery 1.6.x code that otherwise would work. 260 if ( match[ 0 ].charAt( 0 ) === "#" ) { 261 migrateWarn("HTML string cannot start with a '#' character"); 262 jQuery.error("JQMIGRATE: Invalid selector string (XSS)"); 263 } 264 265 // Now process using loose rules; let pre-1.8 play too 266 // Is this a jQuery context? parseHTML expects a DOM element (#178) 267 if ( context && context.context && context.context.nodeType ) { 268 context = context.context; 269 } 270 271 if ( jQuery.parseHTML ) { 272 return oldInit.call( this, 273 jQuery.parseHTML( match[ 2 ], context && context.ownerDocument || 274 context || document, true ), context, rootjQuery ); 275 } 276 } 277 } 278 279 ret = oldInit.apply( this, arguments ); 280 281 // Fill in selector and context properties so .live() works 282 if ( selector && selector.selector !== undefined ) { 283 // A jQuery object, copy its properties 284 ret.selector = selector.selector; 285 ret.context = selector.context; 286 287 } else { 288 ret.selector = typeof selector === "string" ? selector : ""; 289 if ( selector ) { 290 ret.context = selector.nodeType? selector : context || document; 291 } 292 } 293 294 return ret; 295}; 296jQuery.fn.init.prototype = jQuery.fn; 297 298jQuery.find = function( selector ) { 299 var args = Array.prototype.slice.call( arguments ); 300 301 // Support: PhantomJS 1.x 302 // String#match fails to match when used with a //g RegExp, only on some strings 303 if ( typeof selector === "string" && rattrHashTest.test( selector ) ) { 304 305 // The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0 306 // First see if qS thinks it's a valid selector, if so avoid a false positive 307 try { 308 document.querySelector( selector ); 309 } catch ( err1 ) { 310 311 // Didn't *look* valid to qSA, warn and try quoting what we think is the value 312 selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) { 313 return "[" + attr + op + "\"" + value + "\"]"; 314 } ); 315
316 // If the regexp *may* have created an invalid selector, don't update it 317 // Note that there may be false alarms if selector uses jQuery extensions 318 try { 319 document.querySelector( selector ); 320 migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] ); 321 args[ 0 ] = selector; 322 } catch ( err2 ) { 323 migrateWarn( "Attribute selector with '#' was not fixed: " + args[ 0 ] ); 324 } 325 } 326 } 327 328 return oldFind.apply( this, args ); 329}; 330 331// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML) 332var findProp; 333for ( findProp in oldFind ) { 334 if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) { 335 jQuery.find[ findProp ] = oldFind[ findProp ]; 336 } 337} 338 339// Let $.parseJSON(falsy_value) return null 340jQuery.parseJSON = function( json ) { 341 if ( !json ) { 342 migrateWarn("jQuery.parseJSON requires a valid JSON string"); 343 return null; 344 } 345 return oldParseJSON.apply( this, arguments ); 346}; 347 348jQuery.uaMatch = function( ua ) { 349 ua = ua.toLowerCase(); 350 351 var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || 352 /(webkit)[ \/]([\w.]+)/.exec( ua ) || 353 /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || 354 /(msie) ([\w.]+)/.exec( ua ) || 355 ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || 356 []; 357 358 return { 359 browser: match[ 1 ] || "", 360 version: match[ 2 ] || "0" 361 }; 362}; 363 364// Don't clobber any existing jQuery.browser in case it's different 365if ( !jQuery.browser ) { 366 matched = jQuery.uaMatch( navigator.userAgent ); 367 browser = {}; 368 369 if ( matched.browser ) { 370 browser[ matched.browser ] = true; 371 browser.version = matched.version; 372 } 373 374 // Chrome is Webkit, but Webkit is also Safari. 375 if ( browser.chrome ) { 376 browser.webkit = true; 377 } else if ( browser.webkit ) { 378 browser.safari = true; 379 } 380 381 jQuery.browser = browser; 382} 383 384// Warn if the code tries to get jQuery.browser 385migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" ); 386
387// jQuery.boxModel deprecated in 1.3, jQuery.support.boxModel deprecated in 1.7 388jQuery.boxModel = jQuery.support.boxModel = (document.compatMode === "CSS1Compat"); 389migrateWarnProp( jQuery, "boxModel", jQuery.boxModel, "jQuery.boxModel is deprecated" ); 390migrateWarnProp( jQuery.support, "boxModel", jQuery.support.boxModel, "jQuery.support.boxModel is deprecated" ); 391 392jQuery.sub = function() { 393 function jQuerySub( selector, context ) { 394 return new jQuerySub.fn.init( selector, context ); 395 } 396 jQuery.extend( true, jQuerySub, this ); 397 jQuerySub.superclass = this; 398 jQuerySub.fn = jQuerySub.prototype = this(); 399 jQuerySub.fn.constructor = jQuerySub; 400 jQuerySub.sub = this.sub; 401 jQuerySub.fn.init = function init( selector, context ) { 402 var instance = jQuery.fn.init.call( this, selector, context, rootjQuerySub ); 403 return instance instanceof jQuerySub ? 404 instance : 405 jQuerySub( instance ); 406 }; 407 jQuerySub.fn.init.prototype = jQuerySub.fn; 408 var rootjQuerySub = jQuerySub(document); 409 migrateWarn( "jQuery.sub() is deprecated" ); 410 return jQuerySub; 411}; 412 413// The number of elements contained in the matched element set 414jQuery.fn.size = function() { 415 migrateWarn( "jQuery.fn.size() is deprecated; use the .length property" ); 416 return this.length; 417}; 418 419 420var internalSwapCall = false; 421 422// If this version of jQuery has .swap(), don't false-alarm on internal uses 423if ( jQuery.swap ) { 424 jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) { 425 var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get; 426 427 if ( oldHook ) { 428 jQuery.cssHooks[ name ].get = function() { 429 var ret; 430 431 internalSwapCall = true; 432 ret = oldHook.apply( this, arguments ); 433 internalSwapCall = false; 434 return ret; 435 }; 436 } 437 }); 438} 439 440jQuery.swap = function( elem, options, callback, args ) { 441 var ret, name, 442 old = {}; 443 444 if ( !internalSwapCall ) { 445 migrateWarn( "jQuery.swap() is undocumented and deprecated" ); 446 } 447 448 // Remember the old values, and insert the new ones 449 for ( name in options ) { 450 old[ name ] = elem.style[ name ]; 451 elem.style[ name ] = options[ name ]; 452 } 453 454 ret = callback.apply( elem, args || [] ); 455 456 // Revert the old values 457 for ( name in options ) { 458 elem.style[ name ] = old[ name ]; 459 } 460 461 return ret; 462}; 463 464 465// A tolerant "text json" converter, replacing the ajaxSetup override that pointed the 466// converter at jQuery.parseJSON purely so $.ajax picked up Migrate's falsy-value leniency. 467// 468// That leniency is load-bearing and is not carried forward: jQuery 3's own converter is 469// JSON.parse, so a 200 with Content-Type application/json and an empty body resolves with 470// null here and rejects with parsererror under jQuery 3, turning a success into a failure at 471// a site's cutover. A non-empty body still goes through JSON.parse, so malformed JSON rejects 472// exactly as it does today - only the empty case is rescued. 473// 474// On this stack the rescue is behaviour-neutral, because Migrate's own lenient parseJSON 475// already returned null for an empty body. What is new here is the report. This build loads 476// only alongside jQuery 2.2.4, so the same converter has to be added to the patched Migrate 477// 3.5.2 build for the dual-stack window to behave identically, and a page running jQuery 3 478// with no Migrate at all - documentChatUI.cfm, which renders jqStack jq3-none - is not 479// covered by either and still rejects. 480// 481// Installed per request from a prefilter rather than globally, so the closure can name the 482// URL it covered for. Nothing else can: the parse happens inside jQuery's converter chain 483// before any application callback runs, and an asynchronous XHR stack does not retain the 484// code that started the request, so the warning this replaces reached telemetry with no call 485// site at all. Those reports are the work list for deleting this shim along with Migrate. 486jQuery.ajaxPrefilter( function( options, originalOptions, jqXHR ) { 487 var rescued = false; 488 489 // ajaxSetup supplied a default that a per-call converters option could override. A 490 // prefilter runs after that merge and would win instead, so it stays out of the way of a 491 // caller that asked for its own conversion. originalOptions holds only what was passed in. 492 if ( originalOptions.converters && originalOptions.converters[ "text json" ] ) { 493 return; 494 } 495 496 options.converters = options.converters || {};
497 options.converters[ "text json" ] = function( text ) { 498 if ( text ) { 499 return JSON.parse( text ); 500 } 501 rescued = true; 502 return null; 503 }; 504 505 // Reported from here rather than from the converter because the status code is not set on 506 // the jqXHR until after conversion runs, and it decides whether there is anything to fix. 507 // 508 // The test is which responses were supposed to carry a body, and it has to be stated 509 // positively: ajaxConvert runs before isSuccess is consulted, so the converter also sees 510 // responses that failed. A 500 with an empty body rejects on all three stacks, a 304 under 511 // ifModified resolves on all three, and a 204 or any HEAD carries no body by contract. 512 // None of them is a finding, and reporting them would seed the work list with endpoints 513 // that need no change so the count the shim's removal waits on would never reach zero. 514 jqXHR.always( function() { 515 var status = jqXHR.status; 516 517 if ( rescued && status >= 200 && status < 300 && status !== 204 && 518 options.type !== "HEAD" && 519 window.MCJSErrorReporting && MCJSErrorReporting.emptyJSONResponse ) { 520 MCJSErrorReporting.emptyJSONResponse( options.url ); 521 } 522 } ); 523} ); 524 525 526var oldFnData = jQuery.fn.data; 527 528jQuery.fn.data = function( name ) { 529 var ret, evt, 530 elem = this[0]; 531 532 // Handles 1.7 which has this behavior and 1.8 which doesn't 533 if ( elem && name === "events" && arguments.length === 1 ) { 534 ret = jQuery.data( elem, name ); 535 evt = jQuery._data( elem, name ); 536 if ( ( ret === undefined || ret === evt ) && evt !== undefined ) { 537 migrateWarn("Use of jQuery.fn.data('events') is deprecated"); 538 return evt; 539 } 540 } 541 return oldFnData.apply( this, arguments ); 542}; 543 544 545var rscriptType = /\/(java|ecma)script/i; 546 547// Since jQuery.clean is used internally on older versions, we only shim if it's missing 548if ( !jQuery.clean ) { 549 jQuery.clean = function( elems, context, fragment, scripts ) { 550 // Set context per 1.8 logic 551 context = context || document; 552 context = !context.nodeType && context[0] || context; 553 context = context.ownerDocument || context; 554 555 migrateWarn("jQuery.clean() is deprecated"); 556 557 var i, elem, handleScript, jsTags, 558 ret = []; 559 560 jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes ); 561 562 // Complex logic lifted directly from jQuery 1.8 563 if ( fragment ) { 564 // Special handling of each script element 565 handleScript = function( elem ) { 566 // Check if we consider it executable 567 if ( !elem.type || rscriptType.test( elem.type ) ) { 568 // Detach the script and store it in the scripts array (if provided) or the fragment 569 // Return truthy to indicate that it has been handled 570 return scripts ? 571 scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) : 572 fragment.appendChild( elem ); 573 } 574 }; 575 576 for ( i = 0; (elem = ret[i]) != null; i++ ) { 577 // Check if we're done after handling an executable script 578 if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) { 579 // Append to fragment and handle embedded scripts 580 fragment.appendChild( elem ); 581 if ( typeof elem.getElementsByTagName !== "undefined" ) { 582 // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration 583 jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript ); 584 585 // Splice the scripts into ret after their former ancestor and advance our index beyond them 586 ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); 587 i += jsTags.length; 588 } 589 } 590 } 591 } 592 593 return ret; 594 }; 595} 596 597var eventAdd = jQuery.event.add, 598 eventRemove = jQuery.event.remove, 599 eventTrigger = jQuery.event.trigger, 600 oldToggle = jQuery.fn.toggle, 601 oldLive = jQuery.fn.live, 602 oldDie = jQuery.fn.die, 603 oldLoad = jQuery.fn.load, 604 ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess", 605 rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ), 606 rhoverHack = /(?:^|\s)hover(\.\S+|)\b/, 607 hoverHack = function( events ) { 608 if ( typeof( events ) !== "string" || jQuery.event.special.hover ) { 609 return events; 610 } 611 if ( rhoverHack.test( events ) ) { 612 migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"); 613 } 614 return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); 615 }; 616 617// Event props removed in 1.9, put them back if needed; no practical way to warn them 618if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) { 619 jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" ); 620} 621 622// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7 623if ( jQuery.event.dispatch ) { 624 migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" ); 625} 626 627// Support for 'hover' pseudo-event and ajax event warnings 628jQuery.event.add = function( elem, types, handler, data, selector ){ 629 if ( elem !== document && rajaxEvent.test( types ) ) { 630 migrateWarn( "AJAX events should be attached to document: " + types ); 631 } 632 eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector ); 633}; 634jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){ 635 eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes ); 636}; 637 638jQuery.each( [ "load", "unload", "error" ], function( _, name ) { 639 640 jQuery.fn[ name ] = function() { 641 var args = Array.prototype.slice.call( arguments, 0 ); 642 643 // If this is an ajax load() the first arg should be the string URL; 644 // technically this could also be the "Anything" arg of the event .load() 645 // which just goes to show why this dumb signature has been deprecated! 646 // jQuery custom builds that exclude the Ajax module justifiably die here. 647 if ( name === "load" && typeof args[ 0 ] === "string" ) { 648 return oldLoad.apply( this, args ); 649 } 650 651 migrateWarn( "jQuery.fn." + name + "() is deprecated" ); 652 653 args.splice( 0, 0, name ); 654 if ( arguments.length ) { 655 return this.bind.apply( this, args ); 656 } 657 658 // Use .triggerHandler here because: 659 // - load and unload events don't need to bubble, only applied to window or image 660 // - error event should not bubble to window, although it does pre-1.7 661 // See http://bugs.jquery.com/ticket/11820 662 this.triggerHandler.apply( this, args ); 663 return this; 664 }; 665 666}); 667 668jQuery.fn.toggle = function( fn, fn2 ) { 669 670 // Don't mess with animation or css toggles 671 if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) { 672 return oldToggle.apply( this, arguments ); 673 } 674 migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated"); 675 676 // Save reference to arguments for access in closure 677 var args = arguments, 678 guid = fn.guid || jQuery.guid++, 679 i = 0, 680 toggler = function( event ) { 681 // Figure out which function to execute 682 var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; 683 jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); 684 685 // Make sure that clicks stop 686 event.preventDefault(); 687 688 // and execute the function 689 return args[ lastToggle ].apply( this, arguments ) || false; 690 }; 691 692 // link all the functions, so any of them can unbind this click handler 693 toggler.guid = guid; 694 while ( i < args.length ) { 695 args[ i++ ].guid = guid; 696 } 697 698 return this.click( toggler ); 699}; 700 701jQuery.fn.live = function( types, data, fn ) { 702 migrateWarn("jQuery.fn.live() is deprecated"); 703 if ( oldLive ) { 704 return oldLive.apply( this, arguments ); 705 } 706 jQuery( this.context ).on( types, this.selector, data, fn ); 707 return this; 708}; 709 710jQuery.fn.die = function( types, fn ) { 711 migrateWarn("jQuery.fn.die() is deprecated"); 712 if ( oldDie ) { 713 return oldDie.apply( this, arguments ); 714 } 715 jQuery( this.context ).off( types, this.selector || "**", fn ); 716 return this; 717}; 718 719// Turn global events into document-triggered events 720jQuery.event.trigger = function( event, data, elem, onlyHandlers ){ 721 if ( !elem && !rajaxEvent.test( event ) ) { 722 migrateWarn( "Global events are undocumented and deprecated" ); 723 } 724 return eventTrigger.call( this, event, data, elem || document, onlyHandlers ); 725}; 726jQuery.each( ajaxEvents.split("|"), 727 function( _, name ) { 728 jQuery.event.special[ name ] = { 729 setup: function() { 730 var elem = this; 731 732 // The document needs no shimming; must be !== for oldIE 733 if ( elem !== document ) { 734 jQuery.event.add( document, name + "." + jQuery.guid, function() { 735 jQuery.event.trigger( name, Array.prototype.slice.call( arguments, 1 ), elem, true ); 736 }); 737 jQuery._data( this, name, jQuery.guid++ ); 738 } 739 return false;
740 }, 741 teardown: function() { 742 if ( this !== document ) { 743 jQuery.event.remove( document, name + "." + jQuery._data( this, name ) ); 744 } 745 return false; 746 } 747 }; 748 } 749); 750 751jQuery.event.special.ready = { 752 setup: function() { 753 if ( this === document ) { 754 migrateWarn( "'ready' event is deprecated" ); 755 } 756 } 757}; 758 759var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack, 760 oldFnFind = jQuery.fn.find; 761 762jQuery.fn.andSelf = function() { 763 migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"); 764 return oldSelf.apply( this, arguments ); 765}; 766 767jQuery.fn.find = function( selector ) { 768 var ret = oldFnFind.apply( this, arguments ); 769 ret.context = this.context; 770 ret.selector = this.selector ? this.selector + " " + selector : selector; 771 return ret; 772}; 773 774 775// jQuery 1.6 did not support Callbacks, do not warn there 776if ( jQuery.Callbacks ) { 777 778 var oldDeferred = jQuery.Deferred, 779 tuples = [ 780 // action, add listener, callbacks, .then handlers, final state 781 [ "resolve", "done", jQuery.Callbacks("once memory"), 782 jQuery.Callbacks("once memory"), "resolved" ], 783 [ "reject", "fail", jQuery.Callbacks("once memory"), 784 jQuery.Callbacks("once memory"), "rejected" ], 785 [ "notify", "progress", jQuery.Callbacks("memory"), 786 jQuery.Callbacks("memory") ] 787 ]; 788 789 jQuery.Deferred = function( func ) { 790 var deferred = oldDeferred(), 791 promise = deferred.promise(); 792 793 deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) { 794 var fns = arguments; 795 796 migrateWarn( "deferred.pipe() is deprecated" ); 797 798 return jQuery.Deferred(function( newDefer ) { 799 jQuery.each( tuples, function( i, tuple ) { 800 var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; 801 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 802 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 803 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 804 deferred[ tuple[1] ](function() { 805 var returned = fn && fn.apply( this, arguments ); 806 if ( returned && jQuery.isFunction( returned.promise ) ) { 807 returned.promise() 808 .done( newDefer.resolve ) 809 .fail( newDefer.reject ) 810 .progress( newDefer.notify ); 811 } else { 812 newDefer[ tuple[ 0 ] + "With" ]( 813 this === promise ? newDefer.promise() : this, 814 fn ? [ returned ] : arguments 815 ); 816 } 817 }); 818 }); 819 fns = null; 820 }).promise(); 821 822 }; 823 824 deferred.isResolved = function() { 825 migrateWarn( "deferred.isResolved is deprecated" ); 826 return deferred.state() === "resolved"; 827 }; 828 829 deferred.isRejected = function() { 830 migrateWarn( "deferred.isRejected is deprecated" ); 831 return deferred.state() === "rejected"; 832 }; 833 834 if ( func ) { 835 func.call( deferred, deferred ); 836 } 837 838 return deferred; 839 }; 840 841} 842 843})( jQuery, window );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.