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

This commit is contained in:
Mike Sherov
2012-07-09 21:38:11 -04:00
committed by Dave Methvin
parent f30f7732e7
commit 8f01b92b8f
12 changed files with 147 additions and 135 deletions

View File

@@ -1,4 +1,10 @@
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)
document = window.document,
location = window.location,
@@ -24,12 +30,6 @@ var
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
core_rnotwhite = /\S/,
core_rspace = /\s+/,
@@ -449,7 +449,8 @@ jQuery.extend({
},
isEmptyObject: function( obj ) {
for ( var name in obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
@@ -560,7 +561,8 @@ jQuery.extend({
// args is for internal usage only
each: function( obj, callback, args ) {
var name, i = 0,
var name,
i = 0,
length = obj.length,
isObj = length === undefined || jQuery.isFunction( obj );
@@ -616,12 +618,13 @@ jQuery.extend({
// results is for internal usage only
makeArray: function( arr, results ) {
var ret = results || [];
var type,
ret = results || [];
if ( arr != null ) {
// The window, strings (and functions) also have 'length'
// 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 ) ) {
core_push.call( ret, arr );
@@ -656,11 +659,12 @@ jQuery.extend({
},
merge: function( first, second ) {
var i = first.length,
var l = second.length,
i = first.length,
j = 0;
if ( typeof second.length === "number" ) {
for ( var l = second.length; j < l; j++ ) {
if ( typeof l === "number" ) {
for ( ; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
@@ -676,12 +680,15 @@ jQuery.extend({
},
grep: function( elems, callback, inv ) {
var ret = [], retVal;
var retVal,
ret = [],
i = 0,
length = elems.length;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( var i = 0, length = elems.length; i < length; i++ ) {
for ( ; i < length; i++ ) {
retVal = !!callback( elems[ i ], i );
if ( inv !== retVal ) {
ret.push( elems[ i ] );
@@ -693,7 +700,8 @@ jQuery.extend({
// arg is for internal usage only
map: function( elems, callback, arg ) {
var value, key, ret = [],
var value, key,
ret = [],
i = 0,
length = elems.length,
// jquery objects are treated as arrays
@@ -730,8 +738,10 @@ jQuery.extend({
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
var tmp, args, proxy;
if ( typeof context === "string" ) {
var tmp = fn[ context ];
tmp = fn[ context ];
context = fn;
fn = tmp;
}
@@ -743,10 +753,10 @@ jQuery.extend({
}
// Simulated bind
var args = core_slice.call( arguments, 2 ),
proxy = function() {
return fn.apply( context, args.concat( core_slice.call( arguments ) ) );
};
args = core_slice.call( arguments, 2 );
proxy = function() {
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
proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;