cache[ id ] is undefined in jQuery .data() code

cache[ id ] is undefined in jQuery .data() code

Hello,

I need some help and hope anyone can give us advise or help on the error that we're getting when we tried to upgrade to v1.5.2.

In the .data() code we're getting the 'cache[ id ]' is undefined error. Below is where the error is thrown:

line 1376 - 1407 of jQuery 1.5.2:
*******************************************************************************************
if ( !cache[ id ] ) {
     cache[ id ] = {};
     // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
     // metadata on plain JS objects when the object is serialized using
     // JSON.stringify
      if ( !isNode ) {
           cache[ id ].toJSON = jQuery.noop;
      }
}

// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
     if ( pvt ) {
          cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);
     } else {
     cache[ id ] = jQuery.extend(cache[ id ], name);
     }
}

thisCache = cache[id]; 

*******************************************************************************************

The code will throw the undefined error in "cache[ id ].toJSON = jQuery.noop;" since cache[ id ] is declared as {}. When we commented out the toJSON call, the error that we get is 'thisCache' is undefined.

I'm not an expert on jQuery so I hope you can shed some light on this. 

I appreciate the help. Thank you very much!