X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fdata.js;h=500f7ea43f0508c41410e28eff2b661b85dd6991;hb=67d445a703491c90a7d3c46be34bcdceb4d1c896;hp=085db0bb32f6a12dcb974f78f059d972c735d976;hpb=97e134fe80a734b97170bf43c9459511f4e165c7;p=jquery.git diff --git a/src/data.js b/src/data.js index 085db0b..500f7ea 100644 --- a/src/data.js +++ b/src/data.js @@ -14,8 +14,8 @@ jQuery.extend({ var id = elem[ expando ], cache = jQuery.cache, thisCache; // Handle the case where there's no name immediately - if ( !name ) { - return id; + if ( !name && !id ) { + return null; } // Compute a unique ID for the element @@ -39,7 +39,7 @@ jQuery.extend({ thisCache[ name ] = data; } - return name === true ? thisCache : thisCache[ name ]; + return name ? thisCache[ name ] : thisCache; }, removeData: function( elem, name ) { @@ -116,7 +116,9 @@ jQuery.extend({ jQuery.fn.extend({ data: function( key, value ){ - if(typeof key === "undefined" && this.length) return jQuery.data(this[0], true); + if ( typeof key === "undefined" && this.length ) { + return jQuery.data( this[0] ); + } var parts = key.split("."); parts[1] = parts[1] ? "." + parts[1] : ""; @@ -165,4 +167,4 @@ jQuery.fn.extend({ clearQueue: function(type){ return this.queue( type || "fx", [] ); } -}); \ No newline at end of file +});