Index: trunk/phase3/resources/jquery/jquery.tabIndex.js |
— | — | @@ -9,12 +9,14 @@ |
10 | 10 | */ |
11 | 11 | $.fn.firstTabIndex = function() { |
12 | 12 | var minTabIndex = null; |
13 | | - $(this).find( '[tabindex]' ).each( function( i ) { |
| 13 | + $(this).find( '[tabindex]' ).each( function() { |
14 | 14 | var tabIndex = parseInt( $(this).attr( 'tabindex' ), 10 ); |
15 | 15 | // In IE6/IE7 the above jQuery selector returns all elements, |
16 | 16 | // becuase it has a default value for tabIndex in IE6/IE7 of 0 |
17 | | - // (rather than null/undefined). Therefore check "> 0" as well |
18 | | - if ( tabIndex > 0 ) { |
| 17 | + // (rather than null/undefined). Therefore check "> 0" as well. |
| 18 | + // Under IE7 under Windows NT 5.2 is also capable of returning NaN. |
| 19 | + if ( tabIndex > 0 && !isNaN( tabIndex ) ) { |
| 20 | + // Initial value |
19 | 21 | if ( minTabIndex === null ) { |
20 | 22 | minTabIndex = tabIndex; |
21 | 23 | } else if ( tabIndex < minTabIndex ) { |
— | — | @@ -32,12 +34,15 @@ |
33 | 35 | */ |
34 | 36 | $.fn.lastTabIndex = function() { |
35 | 37 | var maxTabIndex = null; |
36 | | - $(this).find( '[tabindex]' ).each( function( i ) { |
| 38 | + $(this).find( '[tabindex]' ).each( function() { |
37 | 39 | var tabIndex = parseInt( $(this).attr( 'tabindex' ), 10 ); |
38 | | - if ( maxTabIndex === null ) { |
39 | | - maxTabIndex = tabIndex; |
40 | | - } else if ( tabIndex > maxTabIndex ) { |
41 | | - maxTabIndex = tabIndex; |
| 40 | + if ( tabIndex > 0 && !isNaN( tabIndex ) ) { |
| 41 | + // Initial value |
| 42 | + if ( maxTabIndex === null ) { |
| 43 | + maxTabIndex = tabIndex; |
| 44 | + } else if ( tabIndex > maxTabIndex ) { |
| 45 | + maxTabIndex = tabIndex; |
| 46 | + } |
42 | 47 | } |
43 | 48 | } ); |
44 | 49 | return maxTabIndex; |