aboutsummaryrefslogtreecommitdiffstats
path: root/src/core.js
diff options
context:
space:
mode:
authortimmywil <timmywillisn@gmail.com>2011-09-15 16:26:35 -0400
committertimmywil <timmywillisn@gmail.com>2011-09-19 15:42:32 -0400
commit29c52b0f6caa23403fd2942aa292b84ce1278191 (patch)
tree702713bf7d098cbc320815b0d2f8c2640c71bc4b /src/core.js
parent76a84fba94e0fd32b1a6612c71ef09dee39f6666 (diff)
downloadjquery-29c52b0f6caa23403fd2942aa292b84ce1278191.tar.gz
jquery-29c52b0f6caa23403fd2942aa292b84ce1278191.zip
Add sparse array performance improvement for inArray. Thanks rwaldron, rkatic, and jdalton
Diffstat (limited to 'src/core.js')
-rw-r--r--src/core.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core.js b/src/core.js
index 41fa8cde6..cee1cee45 100644
--- a/src/core.js
+++ b/src/core.js
@@ -694,7 +694,8 @@ jQuery.extend({
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
- if ( array[ i ] === elem ) {
+ // Skip accessing in sparse arrays
+ if ( i in array && array[ i ] === elem ) {
return i;
}
}