jQuery.cache[ id ][ name ] and Firebug - (Break on All Errors)
This was mentioned in part in the previous post, and this is not about
warnings - I can disregard warnings as they do not cause Firebug to
stop processing the script.
http://groups.google.com/group/jquery-dev/browse_thread/thread/ce38e460847d5066/a0363ea8d7bcbbf1?lnk=gst
When "Break on All Errors" is enabled on Firebug - Firebug breaks on
all undefined variables and other errors, it does not break on
warnings. The problem is the following code (Line 1295) has a good
chance of returning a undefined variable causing Firebug to break,
which can be disruptive when diagnosing a real problem.
// Return the named cache data, or the ID for the element
return name ?
jQuery.cache[ id ][ name ] :
id;
Rewriting the code in the following way is longer, but does not return
undefined.
// Return the named cache data, or the ID for the element
if ( name ) {
// Prevent overriding the named cache with undefined values
if ( data !== undefined )
jQuery.cache[ id ][ name ] = data;
if ( jQuery.cache[ id ][ name ] !== undefined )
return jQuery.cache[ id ][ name ];
return null;
}
return id;
James