Skip to content
Permalink
Browse files

Non-existent attribute for jQuery.attr no longer needs to check for "…

…undefined"

- Remove an unnecessary var

- Use variable in removeAttr for better minification
  • Loading branch information
timmywil
timmywil committed Mar 24, 2011
1 parent dfeeb87 commit 11cfdb23940b2c76e1104c82afc9552ac6f3dc19
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/attributes.js
@@ -317,12 +317,12 @@ jQuery.extend({
return ret;

} else {
var attr = elem.getAttribute( name );
ret = elem.getAttribute( name );

// Non-existent attributes return null, we normalize to undefined
return attr === null || attr === "undefined" || attr === "null" ?
return ret === null || ret === "null" ?
undefined :
attr;
ret;
}
}
},
@@ -336,7 +336,7 @@ jQuery.extend({
// set property to null if getSetAttribute not supported (IE6-7)
// setting className to null makes the class "null"
if ( name === "className" ) {
elem.className = "";
elem[ name ] = "";
} else {
elem.setAttribute( name, null );
}

0 comments on commit 11cfdb2

Please sign in to comment.
You can’t perform that action at this time.