@@ -117,7 +117,7 @@ $.fn.extend({
117
117
} ) ;
118
118
119
119
// selectors
120
- function focusable ( element , isTabIndexNotNaN ) {
120
+ function focusable ( element , hasTabindex ) {
121
121
var map , mapName , img ,
122
122
nodeName = element . nodeName . toLowerCase ( ) ;
123
123
if ( "area" === nodeName ) {
@@ -132,8 +132,8 @@ function focusable( element, isTabIndexNotNaN ) {
132
132
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 ) ?
133
133
! element . disabled :
134
134
"a" === nodeName ?
135
- element . href || isTabIndexNotNaN :
136
- isTabIndexNotNaN ) &&
135
+ element . href || hasTabindex :
136
+ hasTabindex ) &&
137
137
// the element and all of its ancestors must be visible
138
138
visible ( element ) ;
139
139
}
@@ -158,13 +158,13 @@ $.extend( $.expr[ ":" ], {
158
158
} ,
159
159
160
160
focusable : function ( element ) {
161
- return focusable ( element , ! isNaN ( $ . attr ( element , "tabindex" ) ) ) ;
161
+ return focusable ( element , $ . attr ( element , "tabindex" ) != null ) ;
162
162
} ,
163
163
164
164
tabbable : function ( element ) {
165
165
var tabIndex = $ . attr ( element , "tabindex" ) ,
166
- isTabIndexNaN = isNaN ( tabIndex ) ;
167
- return ( isTabIndexNaN || tabIndex >= 0 ) && focusable ( element , ! isTabIndexNaN ) ;
166
+ hasTabindex = tabIndex != null ;
167
+ return ( ! hasTabindex || tabIndex >= 0 ) && focusable ( element , hasTabindex ) ;
168
168
}
169
169
} ) ;
170
170
0 commit comments