Skip to content

Commit

Permalink
Fix for issues discussed in 9faab0b. Goes towards fixing #6808.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Reed authored and jeresig committed Jul 23, 2010
1 parent 266facc commit 2084e01
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -49,24 +50,25 @@ 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;
};
}

} else if ( !cache[ id ] ) {
if ( isNode ) {
cache[ id ] = {};
} else {
var store = {};
store = {};
cache[ id ] = function() {
return store;
};
}

}

thisCache = isNode? cache[ id ] : cache[ id ]();
thisCache = isNode ? cache[ id ] : cache[ id ]();

// Prevent overriding the named cache with undefined values
if ( data !== undefined ) {
Expand Down

0 comments on commit 2084e01

Please sign in to comment.