// 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;
};
} else if ( !cache[ id ] ) {
if ( isNode ) {
cache[ id ] = {};
+
} else {
store = {};
cache[ id ] = function() {
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() {