6 * Finds the lowerst tabindex in use within a selection
8 * @return number Lowest tabindex on the page
10 $.fn
.firstTabIndex = function() {
11 var minTabIndex
= null;
12 $(this).find( '[tabindex]' ).each( function() {
13 var tabIndex
= parseInt( $(this).prop( 'tabindex' ), 10 );
14 // In IE6/IE7 the above jQuery selector returns all elements,
15 // becuase it has a default value for tabIndex in IE6/IE7 of 0
16 // (rather than null/undefined). Therefore check "> 0" as well.
17 // Under IE7 under Windows NT 5.2 is also capable of returning NaN.
18 if ( tabIndex
> 0 && !isNaN( tabIndex
) ) {
20 if ( minTabIndex
=== null ) {
21 minTabIndex
= tabIndex
;
22 } else if ( tabIndex
< minTabIndex
) {
23 minTabIndex
= tabIndex
;
31 * Finds the highest tabindex in use within a selection
33 * @return number Highest tabindex on the page
35 $.fn
.lastTabIndex = function() {
36 var maxTabIndex
= null;
37 $(this).find( '[tabindex]' ).each( function() {
38 var tabIndex
= parseInt( $(this).prop( 'tabindex' ), 10 );
39 if ( tabIndex
> 0 && !isNaN( tabIndex
) ) {
41 if ( maxTabIndex
=== null ) {
42 maxTabIndex
= tabIndex
;
43 } else if ( tabIndex
> maxTabIndex
) {
44 maxTabIndex
= tabIndex
;