// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
- return num == null ?
+ return num != null ?
// Return a 'clean' array
- this.toArray() :
+ ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
// Return just the object
- ( num < 0 ? this[ this.length + num ] : this[ num ] );
+ slice.call( this );
},
// Take an array of elements and push it onto the stack
return jQuery.each( this, callback, args );
},
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function( elem, i ) {
+ return callback.call( elem, i, elem );
+ }));
+ },
+
slice: function() {
return this.pushStack( slice.apply( this, arguments ) );
},
return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
},
- map: function( callback ) {
- return this.pushStack( jQuery.map(this, function( elem, i ) {
- return callback.call( elem, i, elem );
- }));
- },
-
end: function() {
return this.prevObject || this.constructor(null);
},
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
- target = arguments[1] || {};
+
// skip the boolean and the target
- i = 2;
+ target = arguments[ i ] || {};
+ i++;
}
// Handle case when target is a string or something (possible in deep copy)
}
// extend jQuery itself if only one argument is passed
- if ( length === i ) {
+ if ( i === length ) {
target = this;
- --i;
+ i--;
}
for ( ; i < length; i++ ) {
// Assume jQuery is ready without the ready module
isReady: true,
+ error: function( msg ) {
+ throw new Error( msg );
+ },
+
+ noop: function() {},
+
noConflict: function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
type: function( obj ) {
if ( obj == null ) {
- return String( obj );
+ return obj + "";
}
return typeof obj === "object" || typeof obj === "function" ?
class2type[ toString.call(obj) ] || "object" :
typeof obj;
},
- error: function( msg ) {
- throw new Error( msg );
- },
-
- noop: function() {},
-
// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
return first;
},
- grep: function( elems, callback, inv ) {
- var retVal,
- ret = [],
+ grep: function( elems, callback, invert ) {
+ var callbackInverse,
+ matches = [],
i = 0,
- length = elems.length;
- inv = !!inv;
+ length = elems.length,
+ callbackExpect = !invert;
// Go through the array, only saving the items
// that pass the validator function
for ( ; i < length; i++ ) {
- retVal = !!callback( elems[ i ], i );
- if ( inv !== retVal ) {
- ret.push( elems[ i ] );
+ callbackInverse = !callback( elems[ i ], i );
+ if ( callbackInverse !== callbackExpect ) {
+ matches.push( elems[ i ] );
}
}
- return ret;
+ return matches;
},
// arg is for internal usage only
value = callback( elems[ i ], i, arg );
if ( value != null ) {
- ret[ ret.length ] = value;
+ ret.push( value );
}
}
value = callback( elems[ i ], i, arg );
if ( value != null ) {
- ret[ ret.length ] = value;
+ ret.push( value );
}
}
}
},
now: function() {
- return ( new Date() ).getTime();
+ return +( new Date() );
},
// jQuery.support is not used in Core but other projects attach their
var length = obj.length,
type = jQuery.type( obj );
- if ( jQuery.isWindow( obj ) ) {
+ if ( type === "function" || jQuery.isWindow( obj ) ) {
return false;
}
return true;
}
- return type === "array" || type !== "function" &&
- ( length === 0 ||
- typeof length === "number" && length > 0 && ( length - 1 ) in obj );
+ return type === "array" || length === 0 ||
+ typeof length === "number" && length > 0 && ( length - 1 ) in obj;
}
return jQuery;
"./data/accepts"
], function( jQuery, deletedIds, support ) {
-var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
+var rbrace = /(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
rmultiDash = /([A-Z])/g;
function dataAttr( elem, key, data ) {
jQuery.fn.extend({
data: function( key, value ) {
- var attrs, name,
+ var i, name,
data = null,
- i = 0,
- elem = this[0];
+ elem = this[0],
+ attrs = elem && elem.attributes;
// Special expections of .data basically thwart jQuery.access,
// so implement the relevant behavior ourselves
data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
- attrs = elem.attributes;
- for ( ; i < attrs.length; i++ ) {
+ i = attrs.length;
+ while ( i-- ) {
name = attrs[i].name;
if ( name.indexOf("data-") === 0 ) {