aboutsummaryrefslogtreecommitdiffstats
path: root/ui/core.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2015-03-23 18:10:17 -0400
committerScott González <scott.gonzalez@gmail.com>2015-03-25 15:55:03 -0400
commit12643739a93b1f39d0934321973b96989845a606 (patch)
tree7ac2864156bdec24771a66ab5389fb6a0cb0c02a /ui/core.js
parent76c27556f48bea48d3787c241d35e190d46c3245 (diff)
downloadjquery-ui-12643739a93b1f39d0934321973b96989845a606.tar.gz
jquery-ui-12643739a93b1f39d0934321973b96989845a606.zip
Core: Fix `:focusable` and `:tabbable` with jQuery git
jQuery now returns `null` for empty attributes instead of `undefined` Ref gh-1516
Diffstat (limited to 'ui/core.js')
-rw-r--r--ui/core.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/ui/core.js b/ui/core.js
index a8167d683..d6768441b 100644
--- a/ui/core.js
+++ b/ui/core.js
@@ -123,7 +123,7 @@ $.fn.extend( {
} );
// selectors
-function focusable( element, isTabIndexNotNaN ) {
+function focusable( element, hasTabindex ) {
var map, mapName, img,
nodeName = element.nodeName.toLowerCase();
if ( "area" === nodeName ) {
@@ -138,8 +138,8 @@ function focusable( element, isTabIndexNotNaN ) {
return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ?
!element.disabled :
"a" === nodeName ?
- element.href || isTabIndexNotNaN :
- isTabIndexNotNaN ) &&
+ element.href || hasTabindex :
+ hasTabindex ) &&
// the element and all of its ancestors must be visible
visible( element );
}
@@ -164,13 +164,13 @@ $.extend( $.expr[ ":" ], {
},
focusable: function( element ) {
- return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
+ return focusable( element, $.attr( element, "tabindex" ) != null );
},
tabbable: function( element ) {
var tabIndex = $.attr( element, "tabindex" ),
- isTabIndexNaN = isNaN( tabIndex );
- return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
+ hasTabindex = tabIndex != null;
+ return ( !hasTabindex || tabIndex >= 0 ) && focusable( element, hasTabindex );
}
} );