X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fdata.js;h=ac082dd6e97187071f985be94926af83ad9ceb27;hb=6dfdb14753c66cfd38f8445bd6119ef4a1274d5e;hp=562834aa11dc942f4bbffe9e6b9f27200f03e5f7;hpb=9dc6e0c572b9c809a3a4c123071d96d48a01dd1c;p=jquery.git diff --git a/src/data.js b/src/data.js index 562834a..ac082dd 100644 --- a/src/data.js +++ b/src/data.js @@ -52,9 +52,10 @@ jQuery.extend({ // want to manipulate it. if ( typeof name === "object" ) { if ( isNode ) { - cache[ id ] = jQuery.extend(true, {}, name); + cache[ id ] = jQuery.extend(cache[ id ], name); + } else { - store = jQuery.extend(true, {}, name); + store = jQuery.extend(cache[ id ], name); cache[ id ] = function() { return store; }; @@ -63,6 +64,7 @@ jQuery.extend({ } else if ( !cache[ id ] ) { if ( isNode ) { cache[ id ] = {}; + } else { store = {}; cache[ id ] = function() { @@ -129,8 +131,8 @@ jQuery.extend({ jQuery.fn.extend({ data: function( key, value ) { - if ( typeof key === "undefined" && this.length ) { - return jQuery.data( this[0] ); + if ( typeof key === "undefined" ) { + return this.length ? jQuery.data( this[0] ) : null; } else if ( typeof key === "object" ) { return this.each(function() {