Redo r89605 in a better way.
authorKrinkle <krinkle@users.mediawiki.org>
Mon, 6 Jun 2011 21:43:03 +0000 (21:43 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Mon, 6 Jun 2011 21:43:03 +0000 (21:43 +0000)
resources/jquery/jquery.tabIndex.js

index ab708c7..4a42a7e 100644 (file)
@@ -11,13 +11,15 @@ $.fn.firstTabIndex = function() {
        var minTabIndex = null;
        $(this).find( '[tabindex]' ).each( function( i ) {
                var tabIndex = parseInt( $(this).attr( 'tabindex' ), 10 );
-               if ( i === 0 ) {
-                       minTabIndex = tabIndex;
                // In IE6/IE7 the above jQuery selector returns all elements,
                // becuase it has a default value for tabIndex in IE6/IE7 of 0
                // (rather than null/undefined). Therefore check "> 0" as well
-               } else if ( tabIndex > 0 && tabIndex < minTabIndex ) {
-                       minTabIndex = tabIndex;
+               if ( tabIndex > 0 ) {
+                       if ( i === 0 ) {
+                               minTabIndex = tabIndex;
+                       } else if ( tabIndex < minTabIndex ) {
+                               minTabIndex = tabIndex;
+                       }
                }
        } );
        return minTabIndex;