Commit 8f01b92b authored by Mike Sherov's avatar Mike Sherov Committed by Dave Methvin

Follow the style guide, lose 72 bytes! Closes gh-840.

parent f30f7732
var r20 = /%20/g, var // Document location
ajaxLocation,
// Document location segments
ajaxLocParts,
r20 = /%20/g,
rbracket = /\[\]$/, rbracket = /\[\]$/,
rCRLF = /\r?\n/g, rCRLF = /\r?\n/g,
rhash = /#.*$/, rhash = /#.*$/,
...@@ -35,12 +40,6 @@ var r20 = /%20/g, ...@@ -35,12 +40,6 @@ var r20 = /%20/g,
*/ */
transports = {}, transports = {},
// Document location
ajaxLocation,
// Document location segments
ajaxLocParts,
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = ["*/"] + ["*"]; allTypes = ["*/"] + ["*"];
...@@ -70,14 +69,12 @@ function addToPrefiltersOrTransports( structure ) { ...@@ -70,14 +69,12 @@ function addToPrefiltersOrTransports( structure ) {
dataTypeExpression = "*"; dataTypeExpression = "*";
} }
if ( jQuery.isFunction( func ) ) { var dataType, list, placeBefore,
var dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ), dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ),
i = 0, i = 0,
length = dataTypes.length, length = dataTypes.length;
dataType,
list,
placeBefore;
if ( jQuery.isFunction( func ) ) {
// For each dataType in the dataTypeExpression // For each dataType in the dataTypeExpression
for ( ; i < length; i++ ) { for ( ; i < length; i++ ) {
dataType = dataTypes[ i ]; dataType = dataTypes[ i ];
...@@ -104,11 +101,11 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX ...@@ -104,11 +101,11 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX
inspected[ dataType ] = true; inspected[ dataType ] = true;
var list = structure[ dataType ], var selection,
list = structure[ dataType ],
i = 0, i = 0,
length = list ? list.length : 0, length = list ? list.length : 0,
executeOnly = ( structure === prefilters ), executeOnly = ( structure === prefilters );
selection;
for ( ; i < length && ( executeOnly || !selection ); i++ ) { for ( ; i < length && ( executeOnly || !selection ); i++ ) {
selection = list[ i ]( options, originalOptions, jqXHR ); selection = list[ i ]( options, originalOptions, jqXHR );
...@@ -383,7 +380,22 @@ jQuery.extend({ ...@@ -383,7 +380,22 @@ jQuery.extend({
// Force options to be an object // Force options to be an object
options = options || {}; options = options || {};
var // Create the final options object var // ifModified key
ifModifiedKey,
// Response headers
responseHeadersString,
responseHeaders,
// transport
transport,
// timeout handle
timeoutTimer,
// Cross-domain detection vars
parts,
// To know if global events are to be dispatched
fireGlobals,
// Loop variable
i,
// Create the final options object
s = jQuery.ajaxSetup( {}, options ), s = jQuery.ajaxSetup( {}, options ),
// Callbacks context // Callbacks context
callbackContext = s.context || s, callbackContext = s.context || s,
...@@ -398,26 +410,11 @@ jQuery.extend({ ...@@ -398,26 +410,11 @@ jQuery.extend({
completeDeferred = jQuery.Callbacks( "once memory" ), completeDeferred = jQuery.Callbacks( "once memory" ),
// Status-dependent callbacks // Status-dependent callbacks
statusCode = s.statusCode || {}, statusCode = s.statusCode || {},
// ifModified key
ifModifiedKey,
// Headers (they are sent all at once) // Headers (they are sent all at once)
requestHeaders = {}, requestHeaders = {},
requestHeadersNames = {}, requestHeadersNames = {},
// Response headers
responseHeadersString,
responseHeaders,
// transport
transport,
// timeout handle
timeoutTimer,
// Cross-domain detection vars
parts,
// The jqXHR state // The jqXHR state
state = 0, state = 0,
// To know if global events are to be dispatched
fireGlobals,
// Loop variable
i,
// Default abort message // Default abort message
strAbort = "canceled", strAbort = "canceled",
// Fake xhr // Fake xhr
...@@ -759,7 +756,8 @@ jQuery.extend({ ...@@ -759,7 +756,8 @@ jQuery.extend({
// Serialize an array of form elements or a set of // Serialize an array of form elements or a set of
// key/values into a query string // key/values into a query string
param: function( a, traditional ) { param: function( a, traditional ) {
var s = [], var prefix,
s = [],
add = function( key, value ) { add = function( key, value ) {
// If value is a function, invoke it and return its value // If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
...@@ -781,7 +779,7 @@ jQuery.extend({ ...@@ -781,7 +779,7 @@ jQuery.extend({
} else { } else {
// If traditional, encode the "old" way (the way 1.3.2 or older // If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively. // did it), otherwise encode params recursively.
for ( var prefix in a ) { for ( prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add ); buildParams( prefix, a[ prefix ], traditional, add );
} }
} }
...@@ -792,6 +790,8 @@ jQuery.extend({ ...@@ -792,6 +790,8 @@ jQuery.extend({
}); });
function buildParams( prefix, obj, traditional, add ) { function buildParams( prefix, obj, traditional, add ) {
var name;
if ( jQuery.isArray( obj ) ) { if ( jQuery.isArray( obj ) ) {
// Serialize array item. // Serialize array item.
jQuery.each( obj, function( i, v ) { jQuery.each( obj, function( i, v ) {
...@@ -813,7 +813,7 @@ function buildParams( prefix, obj, traditional, add ) { ...@@ -813,7 +813,7 @@ function buildParams( prefix, obj, traditional, add ) {
} else if ( !traditional && jQuery.type( obj ) === "object" ) { } else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item. // Serialize object item.
for ( var name in obj ) { for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
} }
...@@ -843,13 +843,10 @@ jQuery.extend({ ...@@ -843,13 +843,10 @@ jQuery.extend({
*/ */
function ajaxHandleResponses( s, jqXHR, responses ) { function ajaxHandleResponses( s, jqXHR, responses ) {
var contents = s.contents, var ct, type, finalDataType, firstDataType,
contents = s.contents,
dataTypes = s.dataTypes, dataTypes = s.dataTypes,
responseFields = s.responseFields, responseFields = s.responseFields;
ct,
type,
finalDataType,
firstDataType;
// Fill responseXXX fields // Fill responseXXX fields
for ( type in responseFields ) { for ( type in responseFields ) {
......
var // #5280: Internet Explorer will keep connections alive if we don't abort on unload var xhrCallbacks,
// #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort = window.ActiveXObject ? function() { xhrOnUnloadAbort = window.ActiveXObject ? function() {
// Abort all pending requests // Abort all pending requests
for ( var key in xhrCallbacks ) { for ( var key in xhrCallbacks ) {
xhrCallbacks[ key ]( 0, 1 ); xhrCallbacks[ key ]( 0, 1 );
} }
} : false, } : false,
xhrId = 0, xhrId = 0;
xhrCallbacks;
// Functions to create xhrs // Functions to create xhrs
function createStandardXHR() { function createStandardXHR() {
...@@ -57,9 +57,8 @@ if ( jQuery.support.ajax ) { ...@@ -57,9 +57,8 @@ if ( jQuery.support.ajax ) {
send: function( headers, complete ) { send: function( headers, complete ) {
// Get a new xhr // Get a new xhr
var xhr = s.xhr(), var handle, i,
handle, xhr = s.xhr();
i;
// Open the socket // Open the socket
// Passing null username, generates a login popup on Opera (#2865) // Passing null username, generates a login popup on Opera (#2865)
......
var rclass = /[\n\t\r]/g, var nodeHook, boolHook, fixSpecified,
rclass = /[\n\t\r]/g,
rreturn = /\r/g, rreturn = /\r/g,
rtype = /^(?:button|input)$/i, rtype = /^(?:button|input)$/i,
rfocusable = /^(?:button|input|object|select|textarea)$/i, rfocusable = /^(?:button|input|object|select|textarea)$/i,
rclickable = /^a(?:rea)?$/i, rclickable = /^a(?:rea)?$/i,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
getSetAttribute = jQuery.support.getSetAttribute, getSetAttribute = jQuery.support.getSetAttribute;
nodeHook, boolHook, fixSpecified;
jQuery.fn.extend({ jQuery.fn.extend({
attr: function( name, value ) { attr: function( name, value ) {
...@@ -179,7 +179,8 @@ jQuery.fn.extend({ ...@@ -179,7 +179,8 @@ jQuery.fn.extend({
isFunction = jQuery.isFunction( value ); isFunction = jQuery.isFunction( value );
return this.each(function( i ) { return this.each(function( i ) {
var self = jQuery(this), val; var val,
self = jQuery(this);
if ( this.nodeType !== 1 ) { if ( this.nodeType !== 1 ) {
return; return;
......
...@@ -40,11 +40,7 @@ jQuery.Callbacks = function( options ) { ...@@ -40,11 +40,7 @@ jQuery.Callbacks = function( options ) {
( optionsCache[ options ] || createOptions( options ) ) : ( optionsCache[ options ] || createOptions( options ) ) :
jQuery.extend( {}, options ); jQuery.extend( {}, options );
var // Actual callback list var // Last fire value (for non-forgettable lists)
list = [],
// Stack of fire calls for repeatable lists
stack = !options.once && [],
// Last fire value (for non-forgettable lists)
memory, memory,
// Flag to know if list was already fired // Flag to know if list was already fired
fired, fired,
...@@ -56,6 +52,10 @@ jQuery.Callbacks = function( options ) { ...@@ -56,6 +52,10 @@ jQuery.Callbacks = function( options ) {
firingLength, firingLength,
// Index of currently firing callback (modified by remove if needed) // Index of currently firing callback (modified by remove if needed)
firingIndex, firingIndex,
// Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = !options.once && [],
// Fire callbacks // Fire callbacks
fire = function( data ) { fire = function( data ) {
memory = options.memory && data; memory = options.memory && data;
......
var var
// A central reference to the root jQuery(document)
rootjQuery,
// The deferred used on DOM ready
readyList,
// Use the correct document accordingly with window argument (sandbox) // Use the correct document accordingly with window argument (sandbox)
document = window.document, document = window.document,
location = window.location, location = window.location,
...@@ -24,12 +30,6 @@ var ...@@ -24,12 +30,6 @@ var
return new jQuery.fn.init( selector, context, rootjQuery ); return new jQuery.fn.init( selector, context, rootjQuery );
}, },
// A central reference to the root jQuery(document)
rootjQuery,
// The deferred used on DOM ready
readyList,
// Used for detecting and trimming whitespace // Used for detecting and trimming whitespace
core_rnotwhite = /\S/, core_rnotwhite = /\S/,
core_rspace = /\s+/, core_rspace = /\s+/,
...@@ -449,7 +449,8 @@ jQuery.extend({ ...@@ -449,7 +449,8 @@ jQuery.extend({
}, },
isEmptyObject: function( obj ) { isEmptyObject: function( obj ) {
for ( var name in obj ) { var name;
for ( name in obj ) {
return false; return false;
} }
return true; return true;
...@@ -560,7 +561,8 @@ jQuery.extend({ ...@@ -560,7 +561,8 @@ jQuery.extend({
// args is for internal usage only // args is for internal usage only
each: function( obj, callback, args ) { each: function( obj, callback, args ) {
var name, i = 0, var name,
i = 0,
length = obj.length, length = obj.length,
isObj = length === undefined || jQuery.isFunction( obj ); isObj = length === undefined || jQuery.isFunction( obj );
...@@ -616,12 +618,13 @@ jQuery.extend({ ...@@ -616,12 +618,13 @@ jQuery.extend({
// results is for internal usage only // results is for internal usage only
makeArray: function( arr, results ) { makeArray: function( arr, results ) {
var ret = results || []; var type,
ret = results || [];
if ( arr != null ) { if ( arr != null ) {
// The window, strings (and functions) also have 'length' // The window, strings (and functions) also have 'length'
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
var type = jQuery.type( arr ); type = jQuery.type( arr );
if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) { if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) {
core_push.call( ret, arr ); core_push.call( ret, arr );
...@@ -656,11 +659,12 @@ jQuery.extend({ ...@@ -656,11 +659,12 @@ jQuery.extend({
}, },
merge: function( first, second ) { merge: function( first, second ) {
var i = first.length, var l = second.length,
i = first.length,
j = 0; j = 0;
if ( typeof second.length === "number" ) { if ( typeof l === "number" ) {
for ( var l = second.length; j < l; j++ ) { for ( ; j < l; j++ ) {
first[ i++ ] = second[ j ]; first[ i++ ] = second[ j ];
} }
...@@ -676,12 +680,15 @@ jQuery.extend({ ...@@ -676,12 +680,15 @@ jQuery.extend({
}, },
grep: function( elems, callback, inv ) { grep: function( elems, callback, inv ) {
var ret = [], retVal; var retVal,
ret = [],
i = 0,
length = elems.length;
inv = !!inv; inv = !!inv;
// Go through the array, only saving the items // Go through the array, only saving the items
// that pass the validator function // that pass the validator function
for ( var i = 0, length = elems.length; i < length; i++ ) { for ( ; i < length; i++ ) {
retVal = !!callback( elems[ i ], i ); retVal = !!callback( elems[ i ], i );
if ( inv !== retVal ) { if ( inv !== retVal ) {
ret.push( elems[ i ] ); ret.push( elems[ i ] );
...@@ -693,7 +700,8 @@ jQuery.extend({ ...@@ -693,7 +700,8 @@ jQuery.extend({
// arg is for internal usage only // arg is for internal usage only
map: function( elems, callback, arg ) { map: function( elems, callback, arg ) {
var value, key, ret = [], var value, key,
ret = [],
i = 0, i = 0,
length = elems.length, length = elems.length,
// jquery objects are treated as arrays // jquery objects are treated as arrays
...@@ -730,8 +738,10 @@ jQuery.extend({ ...@@ -730,8 +738,10 @@ jQuery.extend({
// Bind a function to a context, optionally partially applying any // Bind a function to a context, optionally partially applying any
// arguments. // arguments.
proxy: function( fn, context ) { proxy: function( fn, context ) {
var tmp, args, proxy;
if ( typeof context === "string" ) { if ( typeof context === "string" ) {
var tmp = fn[ context ]; tmp = fn[ context ];
context = fn; context = fn;
fn = tmp; fn = tmp;
} }
...@@ -743,10 +753,10 @@ jQuery.extend({ ...@@ -743,10 +753,10 @@ jQuery.extend({
} }
// Simulated bind // Simulated bind
var args = core_slice.call( arguments, 2 ), args = core_slice.call( arguments, 2 );
proxy = function() { proxy = function() {
return fn.apply( context, args.concat( core_slice.call( arguments ) ) ); return fn.apply( context, args.concat( core_slice.call( arguments ) ) );
}; };
// Set the guid of unique handler to the same of original handler, so it can be removed // Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
......
// order is important!
jQuery.cssExpand = [ "Top", "Right", "Bottom", "Left" ];
var curCSS, iframe, iframeDoc, var curCSS, iframe, iframeDoc,
ralpha = /alpha\([^)]*\)/i, ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/, ropacity = /opacity=([^)]*)/,
...@@ -11,7 +8,8 @@ var curCSS, iframe, iframeDoc, ...@@ -11,7 +8,8 @@ var curCSS, iframe, iframeDoc,
elemdisplay = {}, elemdisplay = {},
cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssExpand = jQuery.cssExpand, // order is important!
cssExpand = [ "Top", "Right", "Bottom", "Left" ],
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
rposition = /^(top|right|bottom|left)$/, rposition = /^(top|right|bottom|left)$/,
...@@ -254,8 +252,8 @@ jQuery.extend({ ...@@ -254,8 +252,8 @@ jQuery.extend({
// A method for quickly swapping in/out CSS properties to get correct calculations // A method for quickly swapping in/out CSS properties to get correct calculations
swap: function( elem, options, callback ) { swap: function( elem, options, callback ) {
var old = {}, var ret, name,
ret, name; old = {};
// Remember the old values, and insert the new ones // Remember the old values, and insert the new ones
for ( name in options ) { for ( name in options ) {
...@@ -304,14 +302,14 @@ if ( window.getComputedStyle ) { ...@@ -304,14 +302,14 @@ if ( window.getComputedStyle ) {
}; };
} else if ( document.documentElement.currentStyle ) { } else if ( document.documentElement.currentStyle ) {
curCSS = function( elem, name ) { curCSS = function( elem, name ) {
var left, rsLeft, uncomputed, var left, rsLeft,
ret = elem.currentStyle && elem.currentStyle[ name ], ret = elem.currentStyle && elem.currentStyle[ name ],
style = elem.style; style = elem.style;
// Avoid setting ret to empty string here // Avoid setting ret to empty string here
// so we don't default to auto // so we don't default to auto
if ( ret == null && style && (uncomputed = style[ name ]) ) { if ( ret == null && style && style[ name ] ) {
ret = uncomputed; ret = style[ name ];
} }
// From the awesome hack by Dean Edwards // From the awesome hack by Dean Edwards
...@@ -555,8 +553,6 @@ jQuery(function() { ...@@ -555,8 +553,6 @@ jQuery(function() {
return jQuery.swap( elem, { "display": "inline-block" }, function() { return jQuery.swap( elem, { "display": "inline-block" }, function() {
if ( computed ) { if ( computed ) {
return curCSS( elem, "marginRight" ); return curCSS( elem, "marginRight" );
} else {
return elem.style.marginRight;
} }
}); });
} }
...@@ -584,10 +580,7 @@ jQuery(function() { ...@@ -584,10 +580,7 @@ jQuery(function() {
if ( jQuery.expr && jQuery.expr.filters ) { if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) { jQuery.expr.filters.hidden = function( elem ) {
var width = elem.offsetWidth, return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none");
height = elem.offsetHeight;
return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
}; };
jQuery.expr.filters.visible = function( elem ) { jQuery.expr.filters.visible = function( elem ) {
......
...@@ -322,7 +322,8 @@ function dataAttr( elem, key, data ) { ...@@ -322,7 +322,8 @@ function dataAttr( elem, key, data ) {
// checks a cache object for emptiness // checks a cache object for emptiness
function isEmptyDataObject( obj ) { function isEmptyDataObject( obj ) {
for ( var name in obj ) { var name;
for ( name in obj ) {
// if the public data object is empty, the private is still empty // if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
......
...@@ -3,10 +3,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { ...@@ -3,10 +3,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
// margin is only for outerHeight, outerWidth // margin is only for outerHeight, outerWidth
jQuery.fn[ funcName ] = function( margin, value ) { jQuery.fn[ funcName ] = function( margin, value ) {
var clientProp = "client" + name, var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
scrollProp = "scroll" + name,
offsetProp = "offset" + name,
chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
return jQuery.access( this, function( elem, type, value ) { return jQuery.access( this, function( elem, type, value ) {
...@@ -16,7 +13,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { ...@@ -16,7 +13,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
// isn't a whole lot we can do. See pull request at this URL for discussion: // isn't a whole lot we can do. See pull request at this URL for discussion:
// https://github.com/jquery/jquery/pull/764 // https://github.com/jquery/jquery/pull/764
return elem.document.documentElement[ clientProp ]; return elem.document.documentElement[ "client" + name ];
} }
// Get document width or height // Get document width or height
...@@ -26,9 +23,9 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { ...@@ -26,9 +23,9 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
return Math.max( return Math.max(
elem.body[ scrollProp ], doc[ scrollProp ], elem.body[ "scroll" + name ], doc[ "scroll" + name ],
elem.body[ offsetProp ], doc[ offsetProp ], elem.body[ "offset" + name ], doc[ "offset" + name ],
doc[ clientProp ] doc[ "client" + name ]
); );
} }
......
...@@ -428,7 +428,7 @@ Tween.propHooks = { ...@@ -428,7 +428,7 @@ Tween.propHooks = {
function isHidden( elem, el ) { function isHidden( elem, el ) {
elem = el || elem; elem = el || elem;
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument.documentElement, elem ); return curCSS( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument.documentElement, elem );
} }
jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
...@@ -529,7 +529,7 @@ function genFx( type, includeWidth ) { ...@@ -529,7 +529,7 @@ function genFx( type, includeWidth ) {
// if we include width, step value is 1 to do all cssExpand values, // if we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right // if we don't include width, step value is 2 to skip over Left and Right
for( ; i < 4 ; i += 2 - includeWidth ) { for( ; i < 4 ; i += 2 - includeWidth ) {
which = jQuery.cssExpand[ i ]; which = cssExpand[ i ];
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
} }
......
...@@ -130,9 +130,9 @@ jQuery.event = { ...@@ -130,9 +130,9 @@ jQuery.event = {
// Detach an event or set of events from an element // Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) { remove: function( elem, types, handler, selector, mappedTypes ) {
var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), var t, tns, type, origType, namespaces, origCount,
t, tns, type, origType, namespaces, origCount, j, events, special, eventType, handleObj,
j, events, special, eventType, handleObj; elemData = jQuery.hasData( elem ) && jQuery._data( elem );
if ( !elemData || !(events = elemData.events) ) { if ( !elemData || !(events = elemData.events) ) {
return; return;
...@@ -214,9 +214,9 @@ jQuery.event = { ...@@ -214,9 +214,9 @@ jQuery.event = {
} }
// Event object or event type // Event object or event type
var type = event.type || event, var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType,
namespaces = [], type = event.type || event,
cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; namespaces = [];
// focus/blur morphs to focusin/out; ensure we're not firing them right now // focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
...@@ -361,13 +361,13 @@ jQuery.event = { ...@@ -361,13 +361,13 @@ jQuery.event = {
// Make a writable jQuery.Event from the native event object // Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event || window.event ); event = jQuery.event.fix( event || window.event );
var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), var i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related,
handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
delegateCount = handlers.delegateCount, delegateCount = handlers.delegateCount,
args = [].slice.call( arguments ), args = [].slice.call( arguments ),
run_all = !event.exclusive && !event.namespace, run_all = !event.exclusive && !event.namespace,
special = jQuery.event.special[ event.type ] || {}, special = jQuery.event.special[ event.type ] || {},
handlerQueue = [], handlerQueue = [];
i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related;
// Use the fix-ed jQuery.Event rather than the (read-only) native event // Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event; args[0] = event;
...@@ -713,11 +713,11 @@ jQuery.each({ ...@@ -713,11 +713,11 @@ jQuery.each({
bindType: fix, bindType: fix,
handle: function( event ) { handle: function( event ) {
var target = this, var ret,
target = this,
related = event.relatedTarget, related = event.relatedTarget,
handleObj = event.handleObj, handleObj = event.handleObj,
selector = handleObj.selector, selector = handleObj.selector;
ret;
// For mousenter/leave call the handler if related is outside the target. // For mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window // NB: No relatedTarget if the mouse left/entered the browser window
...@@ -921,9 +921,10 @@ jQuery.fn.extend({ ...@@ -921,9 +921,10 @@ jQuery.fn.extend({
return this.on( types, selector, data, fn, 1 ); return this.on( types, selector, data, fn, 1 );
}, },
off: function( types, selector, fn ) { off: function( types, selector, fn ) {
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) { if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event // ( event ) dispatched jQuery.Event
var handleObj = types.handleObj; handleObj = types.handleObj;
jQuery( types.delegateTarget ).off( jQuery( types.delegateTarget ).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
handleObj.selector, handleObj.selector,
...@@ -933,7 +934,7 @@ jQuery.fn.extend({ ...@@ -933,7 +934,7 @@ jQuery.fn.extend({
} }
if ( typeof types === "object" ) { if ( typeof types === "object" ) {
// ( types-object [, selector] ) // ( types-object [, selector] )
for ( var type in types ) { for ( type in types ) {
this.off( type, selector, types[ type ] ); this.off( type, selector, types[ type ] );
} }
return this; return this;
......
...@@ -169,7 +169,10 @@ jQuery.fn.extend({ ...@@ -169,7 +169,10 @@ jQuery.fn.extend({
// keepData is for internal use only--do not document // keepData is for internal use only--do not document
remove: function( selector, keepData ) { remove: function( selector, keepData ) {
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { var elem,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
if ( !keepData && elem.nodeType === 1 ) { if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") ); jQuery.cleanData( elem.getElementsByTagName("*") );
...@@ -186,7 +189,10 @@ jQuery.fn.extend({ ...@@ -186,7 +189,10 @@ jQuery.fn.extend({
}, },
empty: function() { empty: function() {
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { var elem,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks // Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) { if ( elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") ); jQuery.cleanData( elem.getElementsByTagName("*") );
...@@ -480,7 +486,7 @@ function cloneFixAttributes( src, dest ) { ...@@ -480,7 +486,7 @@ function cloneFixAttributes( src, dest ) {
jQuery.buildFragment = function( args, context, scripts ) { jQuery.buildFragment = function( args, context, scripts ) {
var fragment, cacheable, cachehit, var fragment, cacheable, cachehit,
first = args[ 0 ]; first = args[ 0 ];
// Set context from what may come in as undefined or a jQuery collection or a node // Set context from what may come in as undefined or a jQuery collection or a node
context = context || document; context = context || document;
...@@ -533,16 +539,19 @@ jQuery.each({ ...@@ -533,16 +539,19 @@ jQuery.each({
replaceAll: "replaceWith" replaceAll: "replaceWith"
}, function( name, original ) { }, function( name, original ) {
jQuery.fn[ name ] = function( selector ) { jQuery.fn[ name ] = function( selector ) {
var ret = [], var elems,
i = 0,
ret = [],
insert = jQuery( selector ), insert = jQuery( selector ),
l = insert.length,
parent = this.length === 1 && this[0].parentNode; parent = this.length === 1 && this[0].parentNode;
if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && insert.length === 1 ) { if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) {
insert[ original ]( this[0] ); insert[ original ]( this[0] );
return this; return this;
} else { } else {
for ( var i = 0, l = insert.length; i < l; i++ ) { for ( ; i < l; i++ ) {
var elems = ( i > 0 ? this.clone(true) : this ).get(); elems = ( i > 0 ? this.clone(true) : this ).get();
jQuery( insert[i] )[ original ]( elems ); jQuery( insert[i] )[ original ]( elems );
ret = ret.concat( elems ); ret = ret.concat( elems );
} }
......
...@@ -12,8 +12,8 @@ var runtil = /Until$/, ...@@ -12,8 +12,8 @@ var runtil = /Until$/,
jQuery.fn.extend({ jQuery.fn.extend({
find: function( selector ) { find: function( selector ) {
var self = this, var i, l, length, n, r, ret,
i, l; self = this;
if ( typeof selector !== "string" ) { if ( typeof selector !== "string" ) {
return jQuery( selector ).filter(function() { return jQuery( selector ).filter(function() {
...@@ -25,8 +25,7 @@ jQuery.fn.extend({ ...@@ -25,8 +25,7 @@ jQuery.fn.extend({
}); });
} }
var ret = this.pushStack( "", "find", selector ), ret = this.pushStack( "", "find", selector );
length, n, r;
for ( i = 0, l = this.length; i < l; i++ ) { for ( i = 0, l = this.length; i < l; i++ ) {
length = ret.length; length = ret.length;
...@@ -49,9 +48,12 @@ jQuery.fn.extend({ ...@@ -49,9 +48,12 @@ jQuery.fn.extend({
}, },
has: function( target ) { has: function( target ) {
var targets = jQuery( target, this ); var i = 0,
targets = jQuery( target, this ),
l = targets.length;
return this.filter(function() { return this.filter(function() {
for ( var i = 0, l = targets.length; i < l; i++ ) { for ( ; i < l; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) { if ( jQuery.contains( this, targets[i] ) ) {
return true; return true;
} }
...@@ -79,13 +81,15 @@ jQuery.fn.extend({ ...@@ -79,13 +81,15 @@ jQuery.fn.extend({
}, },
closest: function( selectors, context ) { closest: function( selectors, context ) {
var ret = [], i, l, cur; var cur,
i = 0,
var pos = POS.test( selectors ) || typeof selectors !== "string" ? l = this.length,
ret = [],
pos = POS.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) : jQuery( selectors, context || this.context ) :
0; 0;
for ( i = 0, l = this.length; i < l; i++ ) { for ( ; i < l; i++ ) {
cur = this[i]; cur = this[i];
while ( cur ) { while ( cur ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment