More unit tests and a $.hasData that works for JS objects too.

This commit is contained in:
Colin Snover 2010-12-22 15:03:01 -06:00
parent f5d4bf8920
commit e199ead4cb
2 changed files with 17 additions and 7 deletions

View file

@ -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 ) {