Landed cross-browser support for tabIndex, by Scott, closes ticket #3649.

This commit is contained in:
John Resig 2009-01-05 17:34:42 +00:00
parent 42c99472cc
commit 122b672f70
5 changed files with 84 additions and 2 deletions

View file

@ -970,6 +970,13 @@ jQuery.extend({
if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
return elem.getAttributeNode( name ).nodeValue;
// elem.tabindex doesn't always return the correct value
// 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;
}
return elem[ name ];
}

View file

@ -51,6 +51,10 @@
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
// Verify tabindex attribute existence
// (IE uses tabIndex instead of tabindex)
tabindex: !a.getAttributeNode('tabindex'),
// Will be defined later
scriptEval: false,
noCloneEvent: true
@ -96,5 +100,6 @@ jQuery.props = {
readonly: "readOnly",
maxlength: "maxLength",
cellspacing: "cellSpacing",
rowspan: "rowSpan"
rowspan: "rowSpan",
tabindex: jQuery.support.tabindex ? "tabindex" : "tabIndex"
};