Applying conventions and some JSLint good practices in core modules.
[lhc/web/wiklou.git] / resources / jquery / jquery.tabIndex.js
1 /**
2 * jQuery tabIndex
3 */
4 ( function( $ ) {
5 /**
6 * Finds the lowerst tabindex in use within a selection
7 *
8 * @return number Lowest tabindex on the page
9 */
10 $.fn.firstTabIndex = function() {
11 var minTabIndex = 0;
12 $(this).find( '[tabindex]' ).each( function() {
13 var tabIndex = parseInt( $(this).attr( 'tabindex' ), 10 );
14 if ( tabIndex > minTabIndex ) {
15 minTabIndex = tabIndex;
16 }
17 } );
18 return minTabIndex;
19 };
20
21 /**
22 * Finds the highest tabindex in use within a selection
23 *
24 * @return number Highest tabindex on the page
25 */
26 $.fn.lastTabIndex = function() {
27 var maxTabIndex = 0;
28 $(this).find( '[tabindex]' ).each( function() {
29 var tabIndex = parseInt( $(this).attr( 'tabindex' ), 10 );
30 if ( tabIndex > maxTabIndex ) {
31 maxTabIndex = tabIndex;
32 }
33 } );
34 return maxTabIndex;
35 };
36 } )( jQuery );