Attributes: revert returning null for non-existant attributes

Ref https://github.com/jquery/jquery/issues/2118
This commit is contained in:
Timmy Willison
2015-03-30 15:30:21 -04:00
parent e38138af6a
commit 7bce5b0ee1
2 changed files with 44 additions and 48 deletions

View File

@@ -66,7 +66,12 @@ jQuery.extend({
return ret;
} else {
return jQuery.find.attr( elem, name );
ret = jQuery.find.attr( elem, name );
// Non-existent attributes return null, we normalize to undefined
return ret == null ?
undefined :
ret;
}
},