diff options
-rw-r--r-- | src/attributes.js | 16 | ||||
-rw-r--r-- | src/support.js | 3 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/attributes.js b/src/attributes.js index ad75a001d..64b612617 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -313,7 +313,7 @@ jQuery.extend({ } else { - if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem )) !== undefined ) { + if ( hooks && "get" in hooks && notxml && ((ret = hooks.get( elem )) !== undefined || name === "tabIndex") ) { return ret; } else { @@ -325,11 +325,13 @@ jQuery.extend({ } }, - // removeAttribute returns boolean in IE6/7 - // set property to null in that case + // removeAttribute returns boolean in IE + // set property to null if getSetAttribute not supported (IE6-7) removeAttr: function( elem, name ) { - if ( typeof elem.removeAttribute( name ) === "boolean" ) { - elem.setAttribute( name, null ); + name = jQuery.attrFix[ name ] || name; + if ( typeof elem.removeAttribute( name ) === "boolean" && !jQuery.support.getSetAttribute ) { + // Setting className to null sets a class of "null" + name === "className" ? elem.className = "" : elem.setAttribute( name, null ); } }, @@ -399,7 +401,7 @@ if ( !jQuery.support.getSetAttribute ) { frameborder: "frameBorder" }); - // Action attribute in ie6/7 returns form object + // Action attribute in ie6/7 returns form objects jQuery.attrHooks.action = jQuery.extend( jQuery.attrHooks.action, { get: function( elem ) { return elem.nodeName === "FORM" ? elem.getAttributeNode("action").nodeValue : elem.getAttribute("action"); @@ -414,7 +416,7 @@ if ( !jQuery.support.getSetAttribute ) { // Remove certain attrs if set to false jQuery.each([ "selected", "checked", "readonly", "disabled" ], function( i, name ) { name = jQuery.attrFix[ name ] || name; - + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { set: function( elem, value ) { if ( !value ) { // '', undefined, false, null will remove attr diff --git a/src/support.js b/src/support.js index 8e86c46cf..b227293d8 100644 --- a/src/support.js +++ b/src/support.js @@ -58,7 +58,8 @@ // Make sure that a selected-by-default option has a working selected property. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) optSelected: opt.selected, - + + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) getSetAttribute: div.className !== "t", // Will be defined later |