aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.js
diff options
context:
space:
mode:
authorColin Snover <github.com@zetafleet.com>2010-12-22 15:03:01 -0600
committerColin Snover <github.com@zetafleet.com>2010-12-22 15:03:01 -0600
commite199ead4cba3687beca2444eea4bb8abc20f55b6 (patch)
treeb73f7ca5e3099051c2660f291f6d918bbf315ecb /src/data.js
parentf5d4bf8920868c2d1f88cc4f3bfcf85c0b566b2e (diff)
downloadjquery-e199ead4cba3687beca2444eea4bb8abc20f55b6.tar.gz
jquery-e199ead4cba3687beca2444eea4bb8abc20f55b6.zip
More unit tests and a $.hasData that works for JS objects too.
Diffstat (limited to 'src/data.js')
-rw-r--r--src/data.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/data.js b/src/data.js
index c3530c835..549e73ed4 100644
--- a/src/data.js
+++ b/src/data.js
@@ -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 ) {