r946 - branches/experimental/tabbable
Author: scott.gonzalez
Date: Sat Nov 15 05:59:23 2008
New Revision: 946
Modified:
branches/experimental/tabbable/ui.core.js
Log:
Tabbable: Temporary proxy of $.attr.
Modified: branches/experimental/tabbable/ui.core.js
==============================================================================
--- branches/experimental/tabbable/ui.core.js (original)
+++ branches/experimental/tabbable/ui.core.js Sat Nov 15 05:59:23 2008
@@ -1,5 +1,16 @@
(function($) {
+// temporary hack to proxy $.attr
+// everything should be contained in here eventually
+var attr = $.attr;
+$.attr = function(elem, name, value) {
+ if (/tabindex/i.test(name) && value === undefined) {
+ return getTabIndex(elem);
+ }
+
+ return attr.apply(this, arguments);
+};
+
var normalizedTabindex = ($.browser.msie && parseInt($.browser.version,
10) < 8
? 'tabIndex'
: 'tabindex');
@@ -27,7 +38,7 @@
$.extend($.expr[':'], {
focusable: function(element) {
var nodeName = element.nodeName.toLowerCase(),
- tabIndex = getTabIndex(element);
+ tabIndex = $.attr(element, 'tabindex');
return (/input|select|textarea|button|object/.test(nodeName)
? !(element.disabled)
: 'a' == nodeName || 'area' == nodeName
@@ -36,7 +47,7 @@
},
tabbable: function(element) {
- var tabIndex = getTabIndex(element);
+ var tabIndex = $.attr(element, 'tabindex');
return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable');
}
});