Commit c72371f7 authored by Dan Heberden's avatar Dan Heberden

Improve speed of $.map with object support (-5% previous speed) and improve .length detection

parent 00dd6013
...@@ -709,11 +709,10 @@ jQuery.extend({ ...@@ -709,11 +709,10 @@ jQuery.extend({
var value, ret = [], var value, ret = [],
i = 0, i = 0,
length = elems.length, length = elems.length,
// process .length if it's just an object member // jquery objects are treated as arrays
isArray = length !== undefined && ( elems[ length - 1 ] || jQuery.isArray( elems ) ); isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || jQuery.isArray( elems ) ) ;
// Go through the array, translating each of the items to their // Go through the array, translating each of the items to their
// new value (or values).
if ( isArray ) { if ( isArray ) {
for ( ; i < length; i++ ) { for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg ); value = callback( elems[ i ], i, arg );
......
Subproject commit ef19279f54ba49242c6461d47577c703f4f4e80e Subproject commit f12b9309269ba7e705a99efe099f86ed1fe98d58
Subproject commit cc8460c7b44f023c4f84ab1810b72bf6c6ee4542 Subproject commit d404faf8f587fcbe6b8907943022e6318dd51e0c
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