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:
parent
a64dc04050
commit
49f088f2db
|
@ -206,7 +206,6 @@ jQuery.fn.extend({
|
|||
return elem.getAttribute("value") === null ? "on" : elem.value;
|
||||
}
|
||||
|
||||
|
||||
// Everything else, we just grab the value
|
||||
return (elem.value || "").replace(rreturn, "");
|
||||
|
||||
|
@ -289,6 +288,8 @@ jQuery.extend({
|
|||
// Try to normalize/fix the 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
|
||||
var special = rspecialurl.test( name );
|
||||
|
||||
|
@ -372,6 +373,7 @@ jQuery.extend({
|
|||
// Non-existent attributes return null, we normalize to undefined
|
||||
return attr === null ? undefined : attr;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})( jQuery );
|
||||
|
|
Loading…
Reference in a new issue