]> source.dussan.org Git - jquery.git/commitdiff
Supports interoperable removal of hyphenated/camelCase properties. Fixes #9413 455/head
authorRick Waldron <waldron.rick@gmail.com>
Fri, 5 Aug 2011 13:43:58 +0000 (09:43 -0400)
committerRick Waldron <waldron.rick@gmail.com>
Fri, 5 Aug 2011 13:43:58 +0000 (09:43 -0400)
src/data.js

index 1e82961fc6a12e2918adc44e648e91530b133890..279471075ac1278004142215e331b7128ad770f0 100644 (file)
@@ -135,7 +135,12 @@ jQuery.extend({
                        return;
                }
 
-               var internalKey = jQuery.expando, isNode = elem.nodeType,
+               var thisCache,
+
+                       // Reference to internal data cache key
+                       internalKey = jQuery.expando,
+
+                       isNode = elem.nodeType,
 
                        // See jQuery.data for more information
                        cache = isNode ? jQuery.cache : elem,
@@ -150,9 +155,16 @@ jQuery.extend({
                }
 
                if ( name ) {
-                       var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
+
+                       thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
 
                        if ( thisCache ) {
+
+                               // Support interoperable removal of hyphenated or camelcased keys
+                               if ( !thisCache[ name ] ) {
+                                       name = jQuery.camelCase( name );
+                               }
+
                                delete thisCache[ name ];
 
                                // If there is no data left in the cache, we want to continue