Fix for issues discussed in 9faab0b74f. Goes towards fixing #6808.

This commit is contained in:
Dave Reed 2010-07-23 11:25:31 -04:00 committed by jeresig
parent 266facc08a
commit 2084e01780

View file

@ -27,7 +27,8 @@ jQuery.extend({
elem; elem;
var id = elem[ jQuery.expando ], cache = jQuery.cache, thisCache, var id = elem[ jQuery.expando ], cache = jQuery.cache, thisCache,
isNode = elem.nodeType; isNode = elem.nodeType,
store;
if ( !id && typeof name === "string" && data === undefined ) { if ( !id && typeof name === "string" && data === undefined ) {
return; return;
@ -49,8 +50,9 @@ jQuery.extend({
if ( isNode ) { if ( isNode ) {
cache[ id ] = jQuery.extend(true, {}, name); cache[ id ] = jQuery.extend(true, {}, name);
} else { } else {
store = jQuery.extend(true, {}, name);
cache[ id ] = function() { cache[ id ] = function() {
return jQuery.extend(true, {}, name); return store;
}; };
} }
@ -58,7 +60,7 @@ jQuery.extend({
if ( isNode ) { if ( isNode ) {
cache[ id ] = {}; cache[ id ] = {};
} else { } else {
var store = {}; store = {};
cache[ id ] = function() { cache[ id ] = function() {
return store; 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 // Prevent overriding the named cache with undefined values
if ( data !== undefined ) { if ( data !== undefined ) {