mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
More unit tests and a $.hasData that works for JS objects too.
This commit is contained in:
@@ -22,7 +22,11 @@ jQuery.extend({
|
||||
},
|
||||
|
||||
hasData: function( elem ) {
|
||||
return !elem.nodeType || (!!elem[ jQuery.expando ] && !jQuery.isEmptyObject(jQuery.cache[ elem[jQuery.expando] ]));
|
||||
if (elem.nodeType) {
|
||||
elem = jQuery.cache[ elem[jQuery.expando] ];
|
||||
}
|
||||
|
||||
return !!elem && !jQuery.isEmptyObject(elem);
|
||||
},
|
||||
|
||||
data: function( elem, name, data ) {
|
||||
|
||||
Reference in New Issue
Block a user