Partially revert commit a64dc04050.

Removing the conditional was too liberal as now attr() would even work
on plain javascript objects. Keeping a check to make sure it is at least
a DOM Node is appropriate. Using nodeName as in the commit which introduced
the nodeType === 1 check seems plausible.
This commit is contained in:
Anton M 2010-11-10 00:36:53 +01:00
parent a64dc04050
commit 49f088f2db

View file

@ -206,7 +206,6 @@ jQuery.fn.extend({
return elem.getAttribute("value") === null ? "on" : elem.value; return elem.getAttribute("value") === null ? "on" : elem.value;
} }
// Everything else, we just grab the value // Everything else, we just grab the value
return (elem.value || "").replace(rreturn, ""); return (elem.value || "").replace(rreturn, "");
@ -289,6 +288,8 @@ jQuery.extend({
// Try to normalize/fix the name // Try to normalize/fix the name
name = notxml && jQuery.props[ name ] || name; name = notxml && jQuery.props[ name ] || name;
// Only do all the following if this is a node (faster for style)
if ( elem.nodeName ) {
// These attributes require special treatment // These attributes require special treatment
var special = rspecialurl.test( name ); var special = rspecialurl.test( name );
@ -372,6 +373,7 @@ jQuery.extend({
// Non-existent attributes return null, we normalize to undefined // Non-existent attributes return null, we normalize to undefined
return attr === null ? undefined : attr; return attr === null ? undefined : attr;
} }
}
}); });
})( jQuery ); })( jQuery );