diff options
Diffstat (limited to 'ui/jquery.ui.core.js')
-rw-r--r-- | ui/jquery.ui.core.js | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js index 0804edab7..49b5c003b 100644 --- a/ui/jquery.ui.core.js +++ b/ui/jquery.ui.core.js @@ -231,6 +231,13 @@ $.each( [ "Width", "Height" ], function( i, name ) { }); //Additional selectors +function visible( element ) { + return !$(element).parents().andSelf().filter(function() { + return $.curCSS( this, "visibility" ) === "hidden" || + $.expr.filters.hidden( this ); + }).length; +} + $.extend($.expr[':'], { data: function(elem, i, match) { return !!$.data(elem, match[3]); @@ -239,17 +246,23 @@ $.extend($.expr[':'], { focusable: function(element) { var nodeName = element.nodeName.toLowerCase(), tabIndex = $.attr(element, 'tabindex'); + if ( "area" === nodeName ) { + var map = element.parentNode, + mapName = map.name, + img; + if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { + return false; + } + img = $( "img[usemap=#" + mapName + "]" )[0]; + return !!img && visible( img ); + } return (/input|select|textarea|button|object/.test(nodeName) ? !element.disabled - : 'a' == nodeName || 'area' == nodeName + : 'a' == nodeName ? element.href || !isNaN(tabIndex) : !isNaN(tabIndex)) // the element and all of its ancestors must be visible - // the browser may report that the area is hidden - && !$(element).parents().andSelf().filter(function() { - return $.curCSS( this, "visibility" ) === "hidden" || - $.expr.filters.hidden( this ); - }).length; + && visible( element ); }, tabbable: function(element) { |