Use array.indexOf if available (speeds up modern browsers). Thanks to lrbabe and...
[jquery.git] / src / core.js
index cdd7851..611e536 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;