Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added an extra check for removing a named cache property - calling it…

… when it didn't exist caused an exception.
  • Loading branch information...
commit cd6ec6e157f78ab6810ae79c88ebdf6300d5d458 1 parent 139b03a
@jeresig jeresig authored
Showing with 10 additions and 8 deletions.
  1. +10 −8 src/core.js
View
18 src/core.js
@@ -509,14 +509,16 @@ jQuery.extend({
// If we want to remove a specific section of the element's data
if ( name ) {
- // Remove the section of cache data
- delete jQuery.cache[ id ][ name ];
-
- // If we've removed all the data, remove the element's cache
- name = "";
- for ( name in jQuery.cache[ id ] ) break;
- if ( !name )
- jQuery.removeData( elem );
+ if ( jQuery.cache[ id ] ) {
+ // Remove the section of cache data
+ delete jQuery.cache[ id ][ name ];
+
+ // If we've removed all the data, remove the element's cache
+ name = "";
+ for ( name in jQuery.cache[ id ] ) break;
+ if ( !name )
+ jQuery.removeData( elem );
+ }
// Otherwise, we want to remove all of the element's data
} else {
Please sign in to comment.
Something went wrong with that request. Please try again.