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 ];
// (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
maxlength: "maxLength",
cellspacing: "cellSpacing",
rowspan: "rowSpan",
- tabindex: jQuery.support.tabindex ? "tabindex" : "tabIndex"
+ tabindex: "tabIndex"
};
equals(jQuery('#divWithNoTabIndex').attr('tabindex'), undefined, 'no tabindex, not tabbable by default');
// link without a tabindex
- equals(jQuery('#linkWithNoTabIndex').attr('tabindex'), undefined, 'no tabindex, tabbable by default');
+ equals(jQuery('#linkWithNoTabIndex').attr('tabindex'), 0, 'no tabindex, tabbable by default');
});
test("attr('tabindex', value)", function() {
});
test("toggleClass(String)", function() {
- expect(6);\r
+ expect(6);
var e = jQuery("#firstp");
ok( !e.is(".test"), "Assert class not present" );
e.toggleClass("test");
e.toggleClass("test");
ok( !e.is(".test"), "Assert class not present" );
- e.toggleClass("test", false);\r
- ok( !e.is(".test"), "Assert class not present" );\r
- e.toggleClass("test", true);\r
- ok( e.is(".test"), "Assert class present" );\r
- e.toggleClass("test", false);\r
- ok( !e.is(".test"), "Assert class not present" );\r
+ e.toggleClass("test", false);
+ ok( !e.is(".test"), "Assert class not present" );
+ e.toggleClass("test", true);
+ ok( e.is(".test"), "Assert class present" );
+ e.toggleClass("test", false);
+ ok( !e.is(".test"), "Assert class not present" );
});
test("removeAttr(String", function() {