@@ -123,7 +123,7 @@ $.fn.extend( {
123
123
} ) ;
124
124
125
125
// selectors
126
- function focusable ( element , isTabIndexNotNaN ) {
126
+ function focusable ( element , hasTabindex ) {
127
127
var map , mapName , img ,
128
128
nodeName = element . nodeName . toLowerCase ( ) ;
129
129
if ( "area" === nodeName ) {
@@ -138,8 +138,8 @@ function focusable( element, isTabIndexNotNaN ) {
138
138
return ( / ^ ( i n p u t | s e l e c t | t e x t a r e a | b u t t o n | o b j e c t ) $ / . test ( nodeName ) ?
139
139
! element . disabled :
140
140
"a" === nodeName ?
141
- element . href || isTabIndexNotNaN :
142
- isTabIndexNotNaN ) &&
141
+ element . href || hasTabindex :
142
+ hasTabindex ) &&
143
143
// the element and all of its ancestors must be visible
144
144
visible ( element ) ;
145
145
}
@@ -164,13 +164,13 @@ $.extend( $.expr[ ":" ], {
164
164
} ,
165
165
166
166
focusable : function ( element ) {
167
- return focusable ( element , ! isNaN ( $ . attr ( element , "tabindex" ) ) ) ;
167
+ return focusable ( element , $ . attr ( element , "tabindex" ) != null ) ;
168
168
} ,
169
169
170
170
tabbable : function ( element ) {
171
171
var tabIndex = $ . attr ( element , "tabindex" ) ,
172
- isTabIndexNaN = isNaN ( tabIndex ) ;
173
- return ( isTabIndexNaN || tabIndex >= 0 ) && focusable ( element , ! isTabIndexNaN ) ;
172
+ hasTabindex = tabIndex != null ;
173
+ return ( ! hasTabindex || tabIndex >= 0 ) && focusable ( element , hasTabindex ) ;
174
174
}
175
175
} ) ;
176
176
0 commit comments