From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- resources/jquery/jquery.tabIndex.js | 45 ++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 15 deletions(-) (limited to 'resources/jquery/jquery.tabIndex.js') diff --git a/resources/jquery/jquery.tabIndex.js b/resources/jquery/jquery.tabIndex.js index bb9b2bfa..33e06047 100644 --- a/resources/jquery/jquery.tabIndex.js +++ b/resources/jquery/jquery.tabIndex.js @@ -5,31 +5,46 @@ /** * Finds the lowerst tabindex in use within a selection * - * @return Integer of lowest tabindex on the page + * @return number Lowest tabindex on the page */ -jQuery.fn.firstTabIndex = function() { - var minTabIndex = 0; - jQuery(this).find( '[tabindex]' ).each( function() { - var tabIndex = parseInt( jQuery(this).attr( 'tabindex' ) ); - if ( tabIndex > minTabIndex ) { - minTabIndex = tabIndex; +$.fn.firstTabIndex = function() { + var minTabIndex = null; + $(this).find( '[tabindex]' ).each( function() { + var tabIndex = parseInt( $(this).attr( 'tabindex' ), 10 ); + // 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. + // Under IE7 under Windows NT 5.2 is also capable of returning NaN. + if ( tabIndex > 0 && !isNaN( tabIndex ) ) { + // Initial value + if ( minTabIndex === null ) { + minTabIndex = tabIndex; + } else if ( tabIndex < minTabIndex ) { + minTabIndex = tabIndex; + } } } ); return minTabIndex; }; + /** * Finds the highest tabindex in use within a selection * - * @return Integer of highest tabindex on the page + * @return number Highest tabindex on the page */ -jQuery.fn.lastTabIndex = function() { - var maxTabIndex = 0; - jQuery(this).find( '[tabindex]' ).each( function() { - var tabIndex = parseInt( jQuery(this).attr( 'tabindex' ) ); - if ( tabIndex > maxTabIndex ) { - maxTabIndex = tabIndex; +$.fn.lastTabIndex = function() { + var maxTabIndex = null; + $(this).find( '[tabindex]' ).each( function() { + var tabIndex = parseInt( $(this).attr( 'tabindex' ), 10 ); + if ( tabIndex > 0 && !isNaN( tabIndex ) ) { + // Initial value + if ( maxTabIndex === null ) { + maxTabIndex = tabIndex; + } else if ( tabIndex > maxTabIndex ) { + maxTabIndex = tabIndex; + } } } ); return maxTabIndex; }; -} )( jQuery ); \ No newline at end of file +} )( jQuery ); -- cgit v1.2.3-54-g00ecf