diff options
author | Scott González <scott.gonzalez@gmail.com> | 2010-07-21 22:10:16 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2010-07-21 22:10:16 -0400 |
commit | 3f070bdc62a8d00ca6d8428b1a1fe9e39ff72c65 (patch) | |
tree | 93469406fe74f754010e63c6fdb082d4e9b580ee | |
parent | 4c55071976168db5d002f93bcd56fc61e4f55d1f (diff) | |
download | jquery-ui-3f070bdc62a8d00ca6d8428b1a1fe9e39ff72c65.tar.gz jquery-ui-3f070bdc62a8d00ca6d8428b1a1fe9e39ff72c65.zip |
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.
-rw-r--r-- | tests/unit/core/core.html | 26 | ||||
-rw-r--r-- | tests/unit/core/selector.js | 4 | ||||
-rw-r--r-- | 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 4141bcd09..4c769d841 100644 --- a/tests/unit/core/core.html +++ b/tests/unit/core/core.html @@ -82,19 +82,19 @@ <div> <div id="displayNoneAncestor" style="display: none;"> <input id="displayNoneAncestor-input" /> - <span tabindex="1" id="displayNoneAncestor-span"></span> + <span tabindex="1" id="displayNoneAncestor-span">.</span> </div> <div id="visibilityHiddenAncestor" style="visibility: hidden;"> <input id="visibilityHiddenAncestor-input" /> - <span tabindex="1" id="visibilityHiddenAncestor-span"></span> + <span tabindex="1" id="visibilityHiddenAncestor-span">.</span> </div> <input id="displayNone-input" style="display: none;" /> <input id="visibilityHidden-input" style="visibility: hidden;" /> - <span tabindex="1" id="displayNone-span" style="display: none;"></span> - <span tabindex="1" id="visibilityHidden-span" style="visibility: hidden;"></span> + <span tabindex="1" id="displayNone-span" style="display: none;">.</span> + <span tabindex="1" id="visibilityHidden-span" style="visibility: hidden;">.</span> </div> <div> @@ -103,28 +103,28 @@ <input id="inputTabindex-1" tabindex="-1" /> <input id="inputTabindex-50" tabindex="-50" /> - <span id="spanTabindex0" tabindex="0"></span> - <span id="spanTabindex10" tabindex="10"></span> - <span id="spanTabindex-1" tabindex="-1"></span> - <span id="spanTabindex-50" tabindex="-50"></span> + <span id="spanTabindex0" tabindex="0">.</span> + <span id="spanTabindex10" tabindex="10">.</span> + <span id="spanTabindex-1" tabindex="-1">.</span> + <span id="spanTabindex-50" tabindex="-50">.</span> </div> <div> <input id="inputTabindexfoo" tabindex="foo" /> <input id="inputTabindex3foo" tabindex="3foo" /> - <span id="spanTabindexfoo" tabindex="foo"></span> - <span id="spanTabindex3foo" tabindex="3foo"></span> + <span id="spanTabindexfoo" tabindex="foo">.</span> + <span id="spanTabindex3foo" tabindex="3foo">.</span> </div> <div id="zIndex100" style="z-index: 100; position: absolute"> - <div id="zIndexAutoWithParent"></div> + <div id="zIndexAutoWithParent">.</div> </div> <div id="zIndex100ViaCSS" class="zindex"> - <div id="zIndexAutoWithParentViaCSS"></div> + <div id="zIndexAutoWithParentViaCSS">.</div> </div> <div id="zIndex100ViaCSSPositioned" class="zindex absolute"> - <div id="zIndexAutoWithParentViaCSSPositioned"></div> + <div id="zIndexAutoWithParentViaCSSPositioned">.</div> </div> <div id="zIndexAutoNoParent"></div> </div> diff --git a/tests/unit/core/selector.js b/tests/unit/core/selector.js index 269b77e08..11490794a 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 c3ba811f6..bffa51d77 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) { |