From: Timmy Willison Date: Mon, 16 Mar 2015 18:11:38 +0000 (-0400) Subject: Attributes: revert returning null for non-elements X-Git-Tag: 3.0.0-alpha1+compat~102 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a40365549195e4afdf4743f403c12599a3dd4a77;p=jquery.git Attributes: revert returning null for non-elements --- diff --git a/src/attributes/attr.js b/src/attributes/attr.js index 716f4fe25..f5c8dd598 100644 --- a/src/attributes/attr.js +++ b/src/attributes/attr.js @@ -31,7 +31,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 diff --git a/test/unit/attributes.js b/test/unit/attributes.js index ebe171bd9..0ac1345e6 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -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 ) {