Commit b8d0d54a authored by Chris Antaki's avatar Chris Antaki Committed by Richard Gibson

Reduce size by reordering variable declarations

Close gh-1421
parent b278d817
...@@ -11,9 +11,9 @@ var rclass = /[\t\r\n\f]/g; ...@@ -11,9 +11,9 @@ var rclass = /[\t\r\n\f]/g;
jQuery.fn.extend({ jQuery.fn.extend({
addClass: function( value ) { addClass: function( value ) {
var classes, elem, cur, clazz, j, finalValue, var classes, elem, cur, clazz, j, finalValue,
proceed = typeof value === "string" && value,
i = 0, i = 0,
len = this.length, len = this.length;
proceed = typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) { if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) { return this.each(function( j ) {
...@@ -54,9 +54,9 @@ jQuery.fn.extend({ ...@@ -54,9 +54,9 @@ jQuery.fn.extend({
removeClass: function( value ) { removeClass: function( value ) {
var classes, elem, cur, clazz, j, finalValue, var classes, elem, cur, clazz, j, finalValue,
proceed = arguments.length === 0 || typeof value === "string" && value,
i = 0, i = 0,
len = this.length, len = this.length;
proceed = arguments.length === 0 || typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) { if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) { return this.each(function( j ) {
......
...@@ -6,7 +6,7 @@ define([ ...@@ -6,7 +6,7 @@ define([
// The value/s can optionally be executed if it's a function // The value/s can optionally be executed if it's a function
var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
var i = 0, var i = 0,
length = elems.length, len = elems.length,
bulk = key == null; bulk = key == null;
// Sets many values // Sets many values
...@@ -40,7 +40,7 @@ var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGe ...@@ -40,7 +40,7 @@ var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGe
} }
if ( fn ) { if ( fn ) {
for ( ; i < length; i++ ) { for ( ; i < len; i++ ) {
fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
} }
} }
...@@ -52,7 +52,7 @@ var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGe ...@@ -52,7 +52,7 @@ var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGe
// Gets // Gets
bulk ? bulk ?
fn.call( elems ) : fn.call( elems ) :
length ? fn( elems[0], key ) : emptyGet; len ? fn( elems[0], key ) : emptyGet;
}; };
return access; return access;
......
...@@ -82,8 +82,8 @@ function createFxNow() { ...@@ -82,8 +82,8 @@ function createFxNow() {
// Generate parameters to create a standard animation // Generate parameters to create a standard animation
function genFx( type, includeWidth ) { function genFx( type, includeWidth ) {
var which, var which,
attrs = { height: type }, i = 0,
i = 0; attrs = { height: type };
// 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
...@@ -590,8 +590,8 @@ jQuery.each({ ...@@ -590,8 +590,8 @@ jQuery.each({
jQuery.timers = []; jQuery.timers = [];
jQuery.fx.tick = function() { jQuery.fx.tick = function() {
var timer, var timer,
timers = jQuery.timers, i = 0,
i = 0; timers = jQuery.timers;
fxNow = jQuery.now(); fxNow = jQuery.now();
......
...@@ -53,14 +53,14 @@ jQuery.filter = function( expr, elems, not ) { ...@@ -53,14 +53,14 @@ jQuery.filter = function( expr, elems, not ) {
jQuery.fn.extend({ jQuery.fn.extend({
find: function( selector ) { find: function( selector ) {
var i, var i = 0,
len = this.length,
ret = [], ret = [],
self = this, self = this;
len = self.length;
if ( typeof selector !== "string" ) { if ( typeof selector !== "string" ) {
return this.pushStack( jQuery( selector ).filter(function() { return this.pushStack( jQuery( selector ).filter(function() {
for ( i = 0; i < len; i++ ) { for ( ; i < len; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) { if ( jQuery.contains( self[ i ], this ) ) {
return true; return true;
} }
...@@ -68,7 +68,8 @@ jQuery.fn.extend({ ...@@ -68,7 +68,8 @@ jQuery.fn.extend({
}) ); }) );
} }
for ( i = 0; i < len; i++ ) { i = 0;
for ( ; i < len; i++ ) {
jQuery.find( selector, self[ i ], ret ); jQuery.find( selector, self[ i ], ret );
} }
......
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