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({
// 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.nodeType === 1 ) {
// These attributes require special treatment
var special = rspecialurl.test( name );
......@@ -374,7 +372,6 @@ jQuery.extend({
// Non-existent attributes return null, we normalize to undefined
return attr === null ? undefined : attr;
}
}
});
})( jQuery );
......@@ -4,7 +4,7 @@ var bareObj = function(value) { return value; };
var functionReturningObj = function(value) { return (function() { return value; }); };
test("attr(String)", function() {
expect(30);
expect(31);
// This one sometimes fails randomly ?!
equals( jQuery('#text1').attr('value'), "Test", 'Check for value attribute' );
......@@ -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().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 ) {
......
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