X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fdata.js;h=1d5fe8954bf2899b7a653b0be926519f3a189ba9;hb=d36d224cc52e70d837306d33a03f517ef72abc60;hp=e429c0de5cf89367667fbad22acff3a947c1d962;hpb=89b4bc53ca0ca3d4e5c80b94ce92b09cc34af8ef;p=jquery.git diff --git a/src/data.js b/src/data.js index e429c0d..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 ] : @@ -98,6 +100,8 @@ jQuery.extend({ 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