diff options
author | Scott González <scott.gonzalez@gmail.com> | 2009-01-07 14:36:30 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2009-01-07 14:36:30 +0000 |
commit | 49d0d5b7a3628947a14028d14ed042746cc6c3e4 (patch) | |
tree | b30d600ebc5a07b6555e7f1d4bcbcb627cd31a2e /src/core.js | |
parent | f9e0b1ed7a5f252bb58aba9bdfb96653af2b4c1b (diff) | |
download | jquery-49d0d5b7a3628947a14028d14ed042746cc6c3e4.tar.gz jquery-49d0d5b7a3628947a14028d14ed042746cc6c3e4.zip |
Fixed tabindex normalization so that elements that natively support tabbing, but don't have a tabindex explicitly set return 0 instead of undefined.
Removed jQuery.support.tabindex since we're only normalizing non-XML right now and all browsers support tabIndex for HTML documents.
Diffstat (limited to 'src/core.js')
-rw-r--r-- | src/core.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/core.js b/src/core.js index c4c386717..61a9bd9f6 100644 --- a/src/core.js +++ b/src/core.js @@ -968,11 +968,15 @@ jQuery.extend({ if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) return elem.getAttributeNode( name ).nodeValue; - // elem.tabindex doesn't always return the correct value + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - if ( name == jQuery.props.tabindex ) { - var attributeNode = elem.getAttributeNode(jQuery.props.tabindex); - return attributeNode && attributeNode.specified && attributeNode.value || undefined; + if ( name == "tabIndex" ) { + var attributeNode = elem.getAttributeNode( "tabIndex" ); + return attributeNode && attributeNode.specified + ? attributeNode.value + : elem.nodeName.match(/^(a|area|button|input|object|select|textarea)$/i) + ? 0 + : undefined; } return elem[ name ]; |