Skip to content

Commit

Permalink
Attributes: revert returning null for non-elements
Browse files Browse the repository at this point in the history
  • Loading branch information
timmywil committed Mar 16, 2015
1 parent 5dc4616 commit 7632b74
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/attributes/attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jQuery.extend({

// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return null;
return;
}

// Fallback to prop when attributes are not supported
Expand Down
2 changes: 1 addition & 1 deletion test/unit/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ test( "attr(String, Object)", function() {
jQuery.each( [ commentNode, textNode, attributeNode ], function( i, elem ) {
var $elem = jQuery( elem );
$elem.attr( "nonexisting", "foo" );
strictEqual( $elem.attr("nonexisting"), null, "attr(name, value) works correctly on comment and text nodes (bug #7500)." );
strictEqual( $elem.attr("nonexisting"), undefined, "attr(name, value) works correctly on comment and text nodes (bug #7500)." );
});

jQuery.each( [ window, document, obj, "#firstp" ], function( i, elem ) {
Expand Down

0 comments on commit 7632b74

Please sign in to comment.