2012-12-17 12:29:40 -05:00
|
|
|
/*!
|
2013-02-28 13:02:26 -05:00
|
|
|
* jQuery Migrate - v1.1.1 - 2013-02-16
|
2012-12-17 12:29:40 -05:00
|
|
|
* https://github.com/jquery/jquery-migrate
|
2013-01-15 12:52:42 -05:00
|
|
|
* Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
|
2012-12-17 12:29:40 -05:00
|
|
|
*/
|
|
|
|
(function( jQuery, window, undefined ) {
|
2013-02-28 13:02:26 -05:00
|
|
|
// See http://bugs.jquery.com/ticket/13335
|
|
|
|
// "use strict";
|
2012-12-17 12:29:40 -05:00
|
|
|
|
|
|
|
|
|
|
|
var warnedAbout = {};
|
|
|
|
|
|
|
|
// List of warnings already given; public read only
|
|
|
|
jQuery.migrateWarnings = [];
|
|
|
|
|
2013-01-15 12:52:42 -05:00
|
|
|
// Set to true to prevent console output; migrateWarnings still maintained
|
|
|
|
// jQuery.migrateMute = false;
|
|
|
|
|
2013-02-15 11:09:04 -05:00
|
|
|
// Show a message on the console so devs know we're active
|
|
|
|
if ( !jQuery.migrateMute && window.console && console.log ) {
|
|
|
|
console.log("JQMIGRATE: Logging is active");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set to false to disable traces that appear with warnings
|
|
|
|
if ( jQuery.migrateTrace === undefined ) {
|
|
|
|
jQuery.migrateTrace = true;
|
|
|
|
}
|
|
|
|
|
2012-12-17 12:29:40 -05:00
|
|
|
// Forget any warnings we've already given; public
|
|
|
|
jQuery.migrateReset = function() {
|
|
|
|
warnedAbout = {};
|
|
|
|
jQuery.migrateWarnings.length = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
function migrateWarn( msg) {
|
2013-01-15 12:52:42 -05:00
|
|
|
if ( !warnedAbout[ msg ] ) {
|
|
|
|
warnedAbout[ msg ] = true;
|
|
|
|
jQuery.migrateWarnings.push( msg );
|
|
|
|
if ( window.console && console.warn && !jQuery.migrateMute ) {
|
|
|
|
console.warn( "JQMIGRATE: " + msg );
|
2013-02-15 11:09:04 -05:00
|
|
|
if ( jQuery.migrateTrace && console.trace ) {
|
|
|
|
console.trace();
|
|
|
|
}
|
2012-12-17 12:29:40 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function migrateWarnProp( obj, prop, value, msg ) {
|
2013-01-15 12:52:42 -05:00
|
|
|
if ( Object.defineProperty ) {
|
2012-12-17 12:29:40 -05:00
|
|
|
// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
|
|
|
|
// allow property to be overwritten in case some other plugin wants it
|
|
|
|
try {
|
|
|
|
Object.defineProperty( obj, prop, {
|
|
|
|
configurable: true,
|
|
|
|
enumerable: true,
|
|
|
|
get: function() {
|
|
|
|
migrateWarn( msg );
|
|
|
|
return value;
|
|
|
|
},
|
|
|
|
set: function( newValue ) {
|
|
|
|
migrateWarn( msg );
|
|
|
|
value = newValue;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
} catch( err ) {
|
|
|
|
// IE8 is a dope about Object.defineProperty, can't warn there
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Non-ES5 (or broken) browser; just set the property
|
|
|
|
jQuery._definePropertyBroken = true;
|
|
|
|
obj[ prop ] = value;
|
|
|
|
}
|
|
|
|
|
2013-01-15 12:52:42 -05:00
|
|
|
if ( document.compatMode === "BackCompat" ) {
|
2012-12-17 12:29:40 -05:00
|
|
|
// jQuery has never supported or tested Quirks Mode
|
|
|
|
migrateWarn( "jQuery is not compatible with Quirks Mode" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-02-28 13:02:26 -05:00
|
|
|
var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
|
2013-02-15 11:09:04 -05:00
|
|
|
oldAttr = jQuery.attr,
|
2012-12-17 12:29:40 -05:00
|
|
|
valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
|
|
|
|
function() { return null; },
|
|
|
|
valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
|
|
|
|
function() { return undefined; },
|
|
|
|
rnoType = /^(?:input|button)$/i,
|
2013-01-15 12:52:42 -05:00
|
|
|
rnoAttrNodeType = /^[238]$/,
|
|
|
|
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
|
|
|
|
ruseDefault = /^(?:checked|selected)$/i;
|
2012-12-17 12:29:40 -05:00
|
|
|
|
|
|
|
// jQuery.attrFn
|
2013-02-28 13:02:26 -05:00
|
|
|
migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" );
|
2012-12-17 12:29:40 -05:00
|
|
|
|
|
|
|
jQuery.attr = function( elem, name, value, pass ) {
|
2013-01-15 12:52:42 -05:00
|
|
|
var lowerName = name.toLowerCase(),
|
|
|
|
nType = elem && elem.nodeType;
|
|
|
|
|
2013-02-28 13:02:26 -05:00
|
|
|
if ( pass ) {
|
|
|
|
// Since pass is used internally, we only warn for new jQuery
|
|
|
|
// versions where there isn't a pass arg in the formal params
|
|
|
|
if ( oldAttr.length < 4 ) {
|
|
|
|
migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
|
|
|
|
}
|
|
|
|
if ( elem && !rnoAttrNodeType.test( nType ) &&
|
|
|
|
(attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {
|
2012-12-17 12:29:40 -05:00
|
|
|
return jQuery( elem )[ name ]( value );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-15 11:09:04 -05:00
|
|
|
// Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
|
|
|
|
// for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
|
|
|
|
if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
|
2012-12-17 12:29:40 -05:00
|
|
|
migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
|
|
|
|
}
|
|
|
|
|
2013-01-15 12:52:42 -05:00
|
|
|
// Restore boolHook for boolean property/attribute synchronization
|
|
|
|
if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
|
|
|
|
jQuery.attrHooks[ lowerName ] = {
|
|
|
|
get: function( elem, name ) {
|
|
|
|
// Align boolean attributes with corresponding properties
|
|
|
|
// Fall back to attribute presence where some booleans are not supported
|
|
|
|
var attrNode,
|
|
|
|
property = jQuery.prop( elem, name );
|
|
|
|
return property === true || typeof property !== "boolean" &&
|
|
|
|
( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
|
|
|
|
|
|
|
|
name.toLowerCase() :
|
|
|
|
undefined;
|
|
|
|
},
|
|
|
|
set: function( elem, value, name ) {
|
|
|
|
var propName;
|
|
|
|
if ( value === false ) {
|
|
|
|
// Remove boolean attributes when set to false
|
|
|
|
jQuery.removeAttr( elem, name );
|
|
|
|
} else {
|
|
|
|
// value is true since we know at this point it's type boolean and not false
|
|
|
|
// Set boolean attributes to the same name and set the DOM property
|
|
|
|
propName = jQuery.propFix[ name ] || name;
|
|
|
|
if ( propName in elem ) {
|
|
|
|
// Only set the IDL specifically if it already exists on the element
|
|
|
|
elem[ propName ] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
elem.setAttribute( name, name.toLowerCase() );
|
|
|
|
}
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// Warn only for attributes that can remain distinct from their properties post-1.9
|
|
|
|
if ( ruseDefault.test( lowerName ) ) {
|
2013-02-15 11:09:04 -05:00
|
|
|
migrateWarn( "jQuery.fn.attr('" + lowerName + "') may use property instead of attribute" );
|
2013-01-15 12:52:42 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-15 11:09:04 -05:00
|
|
|
return oldAttr.call( jQuery, elem, name, value );
|
2012-12-17 12:29:40 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
// attrHooks: value
|
|
|
|
jQuery.attrHooks.value = {
|
|
|
|
get: function( elem, name ) {
|
2013-01-15 12:52:42 -05:00
|
|
|
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
|
|
|
if ( nodeName === "button" ) {
|
2012-12-17 12:29:40 -05:00
|
|
|
return valueAttrGet.apply( this, arguments );
|
|
|
|
}
|
2013-01-15 12:52:42 -05:00
|
|
|
if ( nodeName !== "input" && nodeName !== "option" ) {
|
2013-02-15 11:09:04 -05:00
|
|
|
migrateWarn("jQuery.fn.attr('value') no longer gets properties");
|
2013-01-15 12:52:42 -05:00
|
|
|
}
|
2012-12-17 12:29:40 -05:00
|
|
|
return name in elem ?
|
|
|
|
elem.value :
|
|
|
|
null;
|
|
|
|
},
|
2013-01-15 12:52:42 -05:00
|
|
|
set: function( elem, value ) {
|
|
|
|
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
|
|
|
if ( nodeName === "button" ) {
|
2012-12-17 12:29:40 -05:00
|
|
|
return valueAttrSet.apply( this, arguments );
|
|
|
|
}
|
2013-01-15 12:52:42 -05:00
|
|
|
if ( nodeName !== "input" && nodeName !== "option" ) {
|
2013-02-15 11:09:04 -05:00
|
|
|
migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
|
2013-01-15 12:52:42 -05:00
|
|
|
}
|
2012-12-17 12:29:40 -05:00
|
|
|
// Does not return so that setAttribute is also used
|
|
|
|
elem.value = value;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var matched, browser,
|
|
|
|
oldInit = jQuery.fn.init,
|
2013-02-15 11:09:04 -05:00
|
|
|
oldParseJSON = jQuery.parseJSON,
|
|
|
|
// Note this does NOT include the #9521 XSS fix from 1.7!
|
|
|
|
rquickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*|#([\w\-]*))$/;
|
2012-12-17 12:29:40 -05:00
|
|
|
|
|
|
|
// $(html) "looks like html" rule change
|
|
|
|
jQuery.fn.init = function( selector, context, rootjQuery ) {
|
|
|
|
var match;
|
|
|
|
|
|
|
|
if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
|
|
|
|
(match = rquickExpr.exec( selector )) && match[1] ) {
|
|
|
|
// This is an HTML string according to the "old" rules; is it still?
|
|
|
|
if ( selector.charAt( 0 ) !== "<" ) {
|
|
|
|
migrateWarn("$(html) HTML strings must start with '<' character");
|
|
|
|
}
|
|
|
|
// Now process using loose rules; let pre-1.8 play too
|
|
|
|
if ( context && context.context ) {
|
|
|
|
// jQuery object as context; parseHTML expects a DOM object
|
|
|
|
context = context.context;
|
|
|
|
}
|
|
|
|
if ( jQuery.parseHTML ) {
|
|
|
|
return oldInit.call( this, jQuery.parseHTML( jQuery.trim(selector), context, true ),
|
|
|
|
context, rootjQuery );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return oldInit.apply( this, arguments );
|
|
|
|
};
|
|
|
|
jQuery.fn.init.prototype = jQuery.fn;
|
|
|
|
|
2013-02-15 11:09:04 -05:00
|
|
|
// Let $.parseJSON(falsy_value) return null
|
|
|
|
jQuery.parseJSON = function( json ) {
|
|
|
|
if ( !json && json !== null ) {
|
|
|
|
migrateWarn("jQuery.parseJSON requires a valid JSON string");
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return oldParseJSON.apply( this, arguments );
|
|
|
|
};
|
|
|
|
|
2012-12-17 12:29:40 -05:00
|
|
|
jQuery.uaMatch = function( ua ) {
|
|
|
|
ua = ua.toLowerCase();
|
|
|
|
|
|
|
|
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
|
|
|
|
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
|
|
|
|
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
|
|
|
|
/(msie) ([\w.]+)/.exec( ua ) ||
|
|
|
|
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
|
|
|
|
[];
|
|
|
|
|
|
|
|
return {
|
|
|
|
browser: match[ 1 ] || "",
|
|
|
|
version: match[ 2 ] || "0"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2013-02-28 13:02:26 -05:00
|
|
|
// Don't clobber any existing jQuery.browser in case it's different
|
|
|
|
if ( !jQuery.browser ) {
|
|
|
|
matched = jQuery.uaMatch( navigator.userAgent );
|
|
|
|
browser = {};
|
2012-12-17 12:29:40 -05:00
|
|
|
|
2013-02-28 13:02:26 -05:00
|
|
|
if ( matched.browser ) {
|
|
|
|
browser[ matched.browser ] = true;
|
|
|
|
browser.version = matched.version;
|
|
|
|
}
|
2012-12-17 12:29:40 -05:00
|
|
|
|
2013-02-28 13:02:26 -05:00
|
|
|
// Chrome is Webkit, but Webkit is also Safari.
|
|
|
|
if ( browser.chrome ) {
|
|
|
|
browser.webkit = true;
|
|
|
|
} else if ( browser.webkit ) {
|
|
|
|
browser.safari = true;
|
|
|
|
}
|
2012-12-17 12:29:40 -05:00
|
|
|
|
2013-02-28 13:02:26 -05:00
|
|
|
jQuery.browser = browser;
|
|
|
|
}
|
2012-12-17 12:29:40 -05:00
|
|
|
|
2012-12-17 15:08:08 -05:00
|
|
|
// Warn if the code tries to get jQuery.browser
|
2013-02-28 13:02:26 -05:00
|
|
|
migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
|
2012-12-17 12:29:40 -05:00
|
|
|
|
|
|
|
jQuery.sub = function() {
|
|
|
|
function jQuerySub( selector, context ) {
|
|
|
|
return new jQuerySub.fn.init( selector, context );
|
|
|
|
}
|
|
|
|
jQuery.extend( true, jQuerySub, this );
|
|
|
|
jQuerySub.superclass = this;
|
|
|
|
jQuerySub.fn = jQuerySub.prototype = this();
|
|
|
|
jQuerySub.fn.constructor = jQuerySub;
|
|
|
|
jQuerySub.sub = this.sub;
|
|
|
|
jQuerySub.fn.init = function init( selector, context ) {
|
|
|
|
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
|
|
|
|
context = jQuerySub( context );
|
|
|
|
}
|
|
|
|
|
|
|
|
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
|
|
|
|
};
|
|
|
|
jQuerySub.fn.init.prototype = jQuerySub.fn;
|
|
|
|
var rootjQuerySub = jQuerySub(document);
|
2012-12-17 15:08:08 -05:00
|
|
|
migrateWarn( "jQuery.sub() is deprecated" );
|
2012-12-17 12:29:40 -05:00
|
|
|
return jQuerySub;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-02-28 13:02:26 -05:00
|
|
|
// Ensure that $.ajax gets the new parseJSON defined in core.js
|
|
|
|
jQuery.ajaxSetup({
|
|
|
|
converters: {
|
|
|
|
"text json": jQuery.parseJSON
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2012-12-17 12:29:40 -05:00
|
|
|
var oldFnData = jQuery.fn.data;
|
|
|
|
|
|
|
|
jQuery.fn.data = function( name ) {
|
|
|
|
var ret, evt,
|
|
|
|
elem = this[0];
|
|
|
|
|
|
|
|
// Handles 1.7 which has this behavior and 1.8 which doesn't
|
|
|
|
if ( elem && name === "events" && arguments.length === 1 ) {
|
|
|
|
ret = jQuery.data( elem, name );
|
|
|
|
evt = jQuery._data( elem, name );
|
|
|
|
if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
|
2012-12-17 15:08:08 -05:00
|
|
|
migrateWarn("Use of jQuery.fn.data('events') is deprecated");
|
2012-12-17 12:29:40 -05:00
|
|
|
return evt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return oldFnData.apply( this, arguments );
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-01-15 12:52:42 -05:00
|
|
|
var rscriptType = /\/(java|ecma)script/i,
|
2013-02-15 11:09:04 -05:00
|
|
|
oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
|
2012-12-17 12:29:40 -05:00
|
|
|
|
|
|
|
jQuery.fn.andSelf = function() {
|
|
|
|
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
|
|
|
|
return oldSelf.apply( this, arguments );
|
|
|
|
};
|
|
|
|
|
2013-01-15 12:52:42 -05:00
|
|
|
// Since jQuery.clean is used internally on older versions, we only shim if it's missing
|
|
|
|
if ( !jQuery.clean ) {
|
|
|
|
jQuery.clean = function( elems, context, fragment, scripts ) {
|
|
|
|
// Set context per 1.8 logic
|
2012-12-17 12:29:40 -05:00
|
|
|
context = context || document;
|
|
|
|
context = !context.nodeType && context[0] || context;
|
|
|
|
context = context.ownerDocument || context;
|
|
|
|
|
2013-01-15 12:52:42 -05:00
|
|
|
migrateWarn("jQuery.clean() is deprecated");
|
|
|
|
|
|
|
|
var i, elem, handleScript, jsTags,
|
|
|
|
ret = [];
|
|
|
|
|
|
|
|
jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
|
|
|
|
|
|
|
|
// Complex logic lifted directly from jQuery 1.8
|
|
|
|
if ( fragment ) {
|
|
|
|
// Special handling of each script element
|
|
|
|
handleScript = function( elem ) {
|
|
|
|
// Check if we consider it executable
|
|
|
|
if ( !elem.type || rscriptType.test( elem.type ) ) {
|
|
|
|
// Detach the script and store it in the scripts array (if provided) or the fragment
|
|
|
|
// Return truthy to indicate that it has been handled
|
|
|
|
return scripts ?
|
|
|
|
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
|
|
|
|
fragment.appendChild( elem );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
for ( i = 0; (elem = ret[i]) != null; i++ ) {
|
|
|
|
// Check if we're done after handling an executable script
|
|
|
|
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
|
|
|
|
// Append to fragment and handle embedded scripts
|
|
|
|
fragment.appendChild( elem );
|
|
|
|
if ( typeof elem.getElementsByTagName !== "undefined" ) {
|
|
|
|
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
|
|
|
|
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
|
|
|
|
|
|
|
|
// Splice the scripts into ret after their former ancestor and advance our index beyond them
|
|
|
|
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
|
|
|
|
i += jsTags.length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2012-12-17 12:29:40 -05:00
|
|
|
var eventAdd = jQuery.event.add,
|
|
|
|
eventRemove = jQuery.event.remove,
|
|
|
|
eventTrigger = jQuery.event.trigger,
|
2012-12-17 15:08:08 -05:00
|
|
|
oldToggle = jQuery.fn.toggle,
|
2012-12-17 12:29:40 -05:00
|
|
|
oldLive = jQuery.fn.live,
|
|
|
|
oldDie = jQuery.fn.die,
|
|
|
|
ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
|
|
|
|
rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
|
|
|
|
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
|
|
|
|
hoverHack = function( events ) {
|
2013-02-28 13:02:26 -05:00
|
|
|
if ( typeof( events ) !== "string" || jQuery.event.special.hover ) {
|
2012-12-17 12:29:40 -05:00
|
|
|
return events;
|
|
|
|
}
|
2012-12-17 15:08:08 -05:00
|
|
|
if ( rhoverHack.test( events ) ) {
|
2012-12-17 12:29:40 -05:00
|
|
|
migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
|
|
|
|
}
|
|
|
|
return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
|
|
|
|
};
|
|
|
|
|
|
|
|
// Event props removed in 1.9, put them back if needed; no practical way to warn them
|
|
|
|
if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
|
|
|
|
jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
|
|
|
|
}
|
|
|
|
|
2013-01-15 12:52:42 -05:00
|
|
|
// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
|
2013-02-15 11:09:04 -05:00
|
|
|
if ( jQuery.event.dispatch ) {
|
|
|
|
migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
|
|
|
|
}
|
2013-01-15 12:52:42 -05:00
|
|
|
|
2012-12-17 12:29:40 -05:00
|
|
|
// Support for 'hover' pseudo-event and ajax event warnings
|
|
|
|
jQuery.event.add = function( elem, types, handler, data, selector ){
|
2012-12-17 15:08:08 -05:00
|
|
|
if ( elem !== document && rajaxEvent.test( types ) ) {
|
2012-12-17 12:29:40 -05:00
|
|
|
migrateWarn( "AJAX events should be attached to document: " + types );
|
|
|
|
}
|
|
|
|
eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
|
|
|
|
};
|
|
|
|
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
|
|
|
|
eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
|
|
|
|
};
|
|
|
|
|
2013-01-15 12:52:42 -05:00
|
|
|
jQuery.fn.error = function() {
|
2012-12-17 12:29:40 -05:00
|
|
|
var args = Array.prototype.slice.call( arguments, 0);
|
2012-12-17 15:08:08 -05:00
|
|
|
migrateWarn("jQuery.fn.error() is deprecated");
|
2012-12-17 12:29:40 -05:00
|
|
|
args.splice( 0, 0, "error" );
|
|
|
|
if ( arguments.length ) {
|
|
|
|
return this.bind.apply( this, args );
|
|
|
|
}
|
|
|
|
// error event should not bubble to window, although it does pre-1.7
|
|
|
|
this.triggerHandler.apply( this, args );
|
|
|
|
return this;
|
|
|
|
};
|
|
|
|
|
|
|
|
jQuery.fn.toggle = function( fn, fn2 ) {
|
|
|
|
|
|
|
|
// Don't mess with animation or css toggles
|
|
|
|
if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
|
|
|
|
return oldToggle.apply( this, arguments );
|
|
|
|
}
|
2012-12-17 15:08:08 -05:00
|
|
|
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
|
2012-12-17 12:29:40 -05:00
|
|
|
|
|
|
|
// Save reference to arguments for access in closure
|
|
|
|
var args = arguments,
|
|
|
|
guid = fn.guid || jQuery.guid++,
|
|
|
|
i = 0,
|
|
|
|
toggler = function( event ) {
|
|
|
|
// Figure out which function to execute
|
|
|
|
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
|
|
|
|
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
|
|
|
|
|
|
|
|
// Make sure that clicks stop
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
// and execute the function
|
|
|
|
return args[ lastToggle ].apply( this, arguments ) || false;
|
|
|
|
};
|
|
|
|
|
|
|
|
// link all the functions, so any of them can unbind this click handler
|
|
|
|
toggler.guid = guid;
|
|
|
|
while ( i < args.length ) {
|
|
|
|
args[ i++ ].guid = guid;
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.click( toggler );
|
|
|
|
};
|
|
|
|
|
|
|
|
jQuery.fn.live = function( types, data, fn ) {
|
2012-12-17 15:08:08 -05:00
|
|
|
migrateWarn("jQuery.fn.live() is deprecated");
|
2012-12-17 12:29:40 -05:00
|
|
|
if ( oldLive ) {
|
|
|
|
return oldLive.apply( this, arguments );
|
|
|
|
}
|
|
|
|
jQuery( this.context ).on( types, this.selector, data, fn );
|
|
|
|
return this;
|
|
|
|
};
|
|
|
|
|
|
|
|
jQuery.fn.die = function( types, fn ) {
|
2012-12-17 15:08:08 -05:00
|
|
|
migrateWarn("jQuery.fn.die() is deprecated");
|
2012-12-17 12:29:40 -05:00
|
|
|
if ( oldDie ) {
|
|
|
|
return oldDie.apply( this, arguments );
|
|
|
|
}
|
|
|
|
jQuery( this.context ).off( types, this.selector || "**", fn );
|
|
|
|
return this;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Turn global events into document-triggered events
|
|
|
|
jQuery.event.trigger = function( event, data, elem, onlyHandlers ){
|
2013-02-28 13:02:26 -05:00
|
|
|
if ( !elem && !rajaxEvent.test( event ) ) {
|
2012-12-17 12:29:40 -05:00
|
|
|
migrateWarn( "Global events are undocumented and deprecated" );
|
|
|
|
}
|
|
|
|
return eventTrigger.call( this, event, data, elem || document, onlyHandlers );
|
|
|
|
};
|
|
|
|
jQuery.each( ajaxEvents.split("|"),
|
|
|
|
function( _, name ) {
|
|
|
|
jQuery.event.special[ name ] = {
|
2013-01-15 12:52:42 -05:00
|
|
|
setup: function() {
|
2012-12-17 12:29:40 -05:00
|
|
|
var elem = this;
|
|
|
|
|
|
|
|
// The document needs no shimming; must be !== for oldIE
|
|
|
|
if ( elem !== document ) {
|
2013-01-15 12:52:42 -05:00
|
|
|
jQuery.event.add( document, name + "." + jQuery.guid, function() {
|
2012-12-17 12:29:40 -05:00
|
|
|
jQuery.event.trigger( name, null, elem, true );
|
|
|
|
});
|
|
|
|
jQuery._data( this, name, jQuery.guid++ );
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
2013-01-15 12:52:42 -05:00
|
|
|
teardown: function() {
|
2012-12-17 12:29:40 -05:00
|
|
|
if ( this !== document ) {
|
|
|
|
jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2013-01-15 12:52:42 -05:00
|
|
|
};
|
2012-12-17 12:29:40 -05:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2013-02-28 13:02:26 -05:00
|
|
|
})( jQuery, window );
|