mirror of
https://github.com/jquery/jquery.git
synced 2026-02-07 22:55:32 -05:00
Add sparse array performance improvement for inArray. Thanks rwaldron, rkatic, and jdalton
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user