Commit 49f088f2 authored by Anton M's avatar Anton M

Partially revert commit a64dc040.

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.
parent a64dc040
...@@ -206,7 +206,6 @@ jQuery.fn.extend({ ...@@ -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({ ...@@ -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({ ...@@ -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 );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment