]> source.dussan.org Git - jquery.git/commitdiff
Use array.indexOf if available (speeds up modern browsers). Thanks to lrbabe and...
authorlrbabe <lrbabe@gmail.com>
Wed, 11 Nov 2009 20:15:58 +0000 (15:15 -0500)
committerJohn Resig <jeresig@gmail.com>
Wed, 11 Nov 2009 20:15:58 +0000 (15:15 -0500)
src/core.js

index cdd78517f453a8d142f2dc07af814c9dc3539c34..611e5363bba0e2530ce70e0726dc33339f505f67 100644 (file)
@@ -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;