diff options
author | Scott González <scott.gonzalez@gmail.com> | 2008-09-05 03:48:47 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2008-09-05 03:48:47 +0000 |
commit | 54eccb6b04303cfaa27fbe3a3ddd1147e5220359 (patch) | |
tree | bddaa12618d61bb015714f91369b4b94e4c9119e /ui | |
parent | d5bea560de6c3046b859440e41d0f6a4b4603182 (diff) | |
download | jquery-ui-54eccb6b04303cfaa27fbe3a3ddd1147e5220359.tar.gz jquery-ui-54eccb6b04303cfaa27fbe3a3ddd1147e5220359.zip |
Core: Added :tabbable selector to find elements that participate in the tabbing order.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ui.core.js | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/ui/ui.core.js b/ui/ui.core.js index 7165ff91a..f4ffb74cb 100644 --- a/ui/ui.core.js +++ b/ui/ui.core.js @@ -17,10 +17,29 @@ $.fn.remove = function() { return _remove.apply(this, arguments ); }; -// This adds a selector to check if data exists. -$.expr[':'].data = function(a, i, m) { - return $.data(a, m[3]); -}; +$.extend($.expr[':'], { + data: function(a, i, m) { + return $.data(a, m[3]); + }, + + // TODO: add support for object, area + tabbable: function(a, i, m) { + var nodeName = a.nodeName.toLowerCase(); + + return ( + // in tab order + a.tabIndex != -1 && + + ( // node type participates in tab order + // anchor tag + ('a' == nodeName) || + + // enabled form element + (/input|select|textarea|button/.test(nodeName) && !a.disabled) + ) + ); + } +}); $.keyCode = { BACKSPACE: 8, |