Added an extra check for removing a named cache property - calling it when it didn't exist caused an exception.

This commit is contained in:
John Resig 2007-09-09 23:08:21 +00:00
parent 139b03af7c
commit cd6ec6e157

View file

@ -509,6 +509,7 @@ jQuery.extend({
// If we want to remove a specific section of the element's data
if ( name ) {
if ( jQuery.cache[ id ] ) {
// Remove the section of cache data
delete jQuery.cache[ id ][ name ];
@ -517,6 +518,7 @@ jQuery.extend({
for ( name in jQuery.cache[ id ] ) break;
if ( !name )
jQuery.removeData( elem );
}
// Otherwise, we want to remove all of the element's data
} else {