Full test suite now passes in all browsers! There are probably some tweaks we can make to shorten and simplify.
- removeAttr now only uses setAttribute if camelCase setAttribute is not supported + Might want to rename jQuery.support.getSetAttribute - tabIndex is a special case now for hooks where undefined should be returned. + Should we be checking if hooks returns undefined? undefined might be the desired return value in future hooks. As of now, tabIndex is the only one that needs it, but the test suite will still pass if we don't check if hooks are undefined.
This commit is contained in:
parent
8cd30c62d8
commit
9f88fa9165
2 changed files with 11 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue