]> source.dussan.org Git - jquery.git/commitdiff
Fix for issues discussed in 9faab0b74fd316c2161612236d9ea8a01f3c78f8. Goes towards...
authorDave Reed <dareed@microsoft.com>
Fri, 23 Jul 2010 15:25:31 +0000 (11:25 -0400)
committerjeresig <jeresig@gmail.com>
Fri, 23 Jul 2010 15:25:31 +0000 (11:25 -0400)
src/data.js

index c524a457dfa2c817a0f7dfe6d3b9bcd3b84aa785..eb96b860f74b9dea789a8921b5ecbc11e471f459 100644 (file)
@@ -27,7 +27,8 @@ jQuery.extend({
                        elem;
 
                var id = elem[ jQuery.expando ], cache = jQuery.cache, thisCache,
-                       isNode = elem.nodeType;
+                       isNode = elem.nodeType,
+                       store;
 
                if ( !id && typeof name === "string" && data === undefined ) {
                        return;
@@ -49,8 +50,9 @@ jQuery.extend({
                        if ( isNode ) {
                                cache[ id ] = jQuery.extend(true, {}, name);
                        } else {
+                               store = jQuery.extend(true, {}, name);
                                cache[ id ] = function() {
-                                       return jQuery.extend(true, {}, name);
+                                       return store;
                                };
                        }
 
@@ -58,7 +60,7 @@ jQuery.extend({
                        if ( isNode ) {
                                cache[ id ] = {};
                        } else {
-                               var store = {};
+                               store = {};
                                cache[ id ] = function() {
                                        return store;
                                };
@@ -66,7 +68,7 @@ jQuery.extend({
                        
                }
 
-               thisCache = isNode? cache[ id ] : cache[ id ]();
+               thisCache = isNode ? cache[ id ] : cache[ id ]();
 
                // Prevent overriding the named cache with undefined values
                if ( data !== undefined ) {