aboutsummaryrefslogtreecommitdiffstats
path: root/ui
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>2016-06-09 13:13:35 -0400
commit6fd43da409b02a078bb697d93abec9d2e15b8d30 (patch)
tree526218090dc9b7652a10e340df357b5d67e851c2 /ui
parent413a9c99f895f1f2d60a4145d8bac402ac6bb19f (diff)
downloadjquery-ui-6fd43da409b02a078bb697d93abec9d2e15b8d30.tar.gz
jquery-ui-6fd43da409b02a078bb697d93abec9d2e15b8d30.zip
Core: Fix `:focusable` and `:tabbable` with jQuery git
jQuery now returns `null` for empty attributes instead of `undefined` Ref gh-1516 (cherry picked from commit 12643739a93b1f39d0934321973b96989845a606)
Diffstat (limited to 'ui')
-rw-r--r--ui/core.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/ui/core.js b/ui/core.js
index 462d10bb8..1e40c9443 100644
--- a/ui/core.js
+++ b/ui/core.js
@@ -117,7 +117,7 @@ $.fn.extend({
});
// selectors
-function focusable( element, isTabIndexNotNaN ) {
+function focusable( element, hasTabindex ) {
var map, mapName, img,
nodeName = element.nodeName.toLowerCase();
if ( "area" === nodeName ) {
@@ -132,8 +132,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 );
}
@@ -158,13 +158,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 );
}
});