From 3f070bdc62a8d00ca6d8428b1a1fe9e39ff72c65 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Wed, 21 Jul 2010 22:10:16 -0400
Subject: [PATCH] Core: Fixed :focusable and :tabbable selectors for to work
with :hidden and :visibile selectors in jQuery 1.3.2+. Still need to handle
areas properly. Partial fix for #4488 - :focusable and :tabbable are broken
with jQuery 1.3.2.
---
tests/unit/core/core.html | 26 +++++++++++++-------------
tests/unit/core/selector.js | 4 ++--
ui/jquery.ui.core.js | 5 ++++-
3 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/tests/unit/core/core.html b/tests/unit/core/core.html
index 4141bcd0978..4c769d8417c 100644
--- a/tests/unit/core/core.html
+++ b/tests/unit/core/core.html
@@ -82,19 +82,19 @@
@@ -103,28 +103,28 @@
-
-
-
-
+ .
+ .
+ .
+ .
-
-
+ .
+ .
diff --git a/tests/unit/core/selector.js b/tests/unit/core/selector.js
index 269b77e08c9..11490794a8d 100644
--- a/tests/unit/core/selector.js
+++ b/tests/unit/core/selector.js
@@ -132,7 +132,7 @@ test("focusable - hidden styles", function() {
isNotFocusable('#visibilityHidden-span', 'span with tabindex, visibility: hidden');
});
-test("focusable - natively focusable with various tabindex", function() {
+test("focusable - natively focusable with various tabindex", function() {
expect(4);
isFocusable('#inputTabindex0', 'input, tabindex 0');
@@ -141,7 +141,7 @@ test("focusable - natively focusable with various tabindex", function() {
isFocusable('#inputTabindex-50', 'input, tabindex -50');
});
-test("focusable - not natively focusable with various tabindex", function() {
+test("focusable - not natively focusable with various tabindex", function() {
expect(4);
isFocusable('#spanTabindex0', 'span, tabindex 0');
diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js
index c3ba811f6c8..bffa51d7721 100644
--- a/ui/jquery.ui.core.js
+++ b/ui/jquery.ui.core.js
@@ -203,7 +203,10 @@ $.extend($.expr[':'], {
: !isNaN(tabIndex))
// the element and all of its ancestors must be visible
// the browser may report that the area is hidden
- && !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
+ && !$(element).parents().andSelf().filter(function() {
+ return $.curCSS( this, "visibility" ) === "hidden" ||
+ $.expr.filters.hidden( this );
+ }).length;
},
tabbable: function(element) {