X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fdata.js;h=1d5fe8954bf2899b7a653b0be926519f3a189ba9;hb=d36d224cc52e70d837306d33a03f517ef72abc60;hp=8c79c214476ae1db5bda4b8bbf50c1d81c1bcba1;hpb=d857315967a1cc07b73924bbdf2eb12f4f910c45;p=jquery.git diff --git a/src/data.js b/src/data.js index 8c79c21..1d5fe89 100644 --- a/src/data.js +++ b/src/data.js @@ -23,6 +23,8 @@ jQuery.extend({ if ( data !== undefined ) jQuery.cache[ id ][ name ] = data; + if(name === true) return jQuery.cache[ id ] + // Return the named cache data, or the ID for the element return name ? jQuery.cache[ id ][ name ] : @@ -93,11 +95,13 @@ jQuery.extend({ if( fn !== undefined ) fn.call(elem, function() { jQuery(elem).dequeue(type); }); - }, + } }); jQuery.fn.extend({ data: function( key, value ){ + if(typeof key === "undefined" && this.length) return jQuery.data(this[0], true); + var parts = key.split("."); parts[1] = parts[1] ? "." + parts[1] : ""; @@ -130,11 +134,11 @@ jQuery.fn.extend({ if ( data === undefined ) return jQuery.queue( this[0], type ); - return this.each(function(){ + return this.each(function(i, elem){ var queue = jQuery.queue( this, type, data ); - if( type == "fx" && queue.length == 1 ) - queue[0].call(this); + if( type == "fx" && queue.length == 1 ) + queue[0].call(this, function() { jQuery(elem).dequeue(type); }); }); }, dequeue: function(type){ @@ -143,6 +147,6 @@ jQuery.fn.extend({ }); }, clearQueue: function(type){ - return this.queue( type, [] ); + return this.queue( type || "fx", [] ); } }); \ No newline at end of file