]> source.dussan.org Git - jquery.git/commitdiff
Added an extra check for removing a named cache property - calling it when it didn...
authorJohn Resig <jeresig@gmail.com>
Sun, 9 Sep 2007 23:08:21 +0000 (23:08 +0000)
committerJohn Resig <jeresig@gmail.com>
Sun, 9 Sep 2007 23:08:21 +0000 (23:08 +0000)
src/core.js

index 3fb59f8d5e52f68303023c2549c7ab895318f10b..c1e7d9f1b1a65377bd34d1630bcc536b8a490ca5 100644 (file)
@@ -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 {