X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fdata.js;h=1d5fe8954bf2899b7a653b0be926519f3a189ba9;hb=d36d224cc52e70d837306d33a03f517ef72abc60;hp=ac069ceea593910ee60e0c3178f88e345c4c68c0;hpb=f8ef75eb9124ce924be5fb521c783efd5c996e33;p=jquery.git diff --git a/src/data.js b/src/data.js index ac069ce..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 ] : @@ -92,12 +94,14 @@ jQuery.extend({ fn = queue[0]; if( fn !== undefined ) - fn.call(elem); + 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,16 +134,19 @@ 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){ return this.each(function(){ jQuery.dequeue( this, type ); }); + }, + clearQueue: function(type){ + return this.queue( type || "fx", [] ); } }); \ No newline at end of file