Commit a64dc040 authored by Colin Snover's avatar Colin Snover Committed by John Resig

Remove conditional that prevents attr from working on non-Element nodes. Fixes #7451.

parent d1a88b2e
...@@ -289,8 +289,6 @@ jQuery.extend({ ...@@ -289,8 +289,6 @@ 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.nodeType === 1 ) {
// These attributes require special treatment // These attributes require special treatment
var special = rspecialurl.test( name ); var special = rspecialurl.test( name );
...@@ -374,7 +372,6 @@ jQuery.extend({ ...@@ -374,7 +372,6 @@ 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 );
...@@ -4,7 +4,7 @@ var bareObj = function(value) { return value; }; ...@@ -4,7 +4,7 @@ var bareObj = function(value) { return value; };
var functionReturningObj = function(value) { return (function() { return value; }); }; var functionReturningObj = function(value) { return (function() { return value; }); };
test("attr(String)", function() { test("attr(String)", function() {
expect(30); expect(31);
// This one sometimes fails randomly ?! // This one sometimes fails randomly ?!
equals( jQuery('#text1').attr('value'), "Test", 'Check for value attribute' ); equals( jQuery('#text1').attr('value'), "Test", 'Check for value attribute' );
...@@ -65,6 +65,8 @@ test("attr(String)", function() { ...@@ -65,6 +65,8 @@ test("attr(String)", function() {
ok( jQuery("<div/>").attr("doesntexist") === undefined, "Make sure undefined is returned when no attribute is found." ); ok( jQuery("<div/>").attr("doesntexist") === undefined, "Make sure undefined is returned when no attribute is found." );
ok( jQuery().attr("doesntexist") === undefined, "Make sure undefined is returned when no element is there." ); ok( jQuery().attr("doesntexist") === undefined, "Make sure undefined is returned when no element is there." );
equals( jQuery(document).attr("nodeName"), "#document", "attr works correctly on document nodes (bug #7451)." );
}); });
if ( !isLocal ) { if ( !isLocal ) {
......
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