git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Use array.indexOf if available (speeds up modern browsers). Thanks to lrbabe and...
[jquery.git]
/
src
/
core.js
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;