git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5ac2e08
)
Use array.indexOf if available (speeds up modern browsers). Thanks to lrbabe and...
author
lrbabe
<lrbabe@gmail.com>
Wed, 11 Nov 2009 20:15:58 +0000
(15:15 -0500)
committer
John Resig
<jeresig@gmail.com>
Wed, 11 Nov 2009 20:15:58 +0000
(15:15 -0500)
src/core.js
patch
|
blob
|
history
diff --git
a/src/core.js
b/src/core.js
index
cdd7851
..
611e536
100644
(file)
--- a/
src/core.js
+++ b/
src/core.js
@@
-441,6
+441,10
@@
jQuery.extend({
},
inArray: function( elem, array ) {
+ if ( array.indexOf ) {
+ return array.indexOf( elem );
+ }
+
for ( var i = 0, length = array.length; i < length; i++ ) {
if ( array[ i ] === elem ) {
return i;