aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.js
diff options
context:
space:
mode:
authorRick Waldron <waldron.rick@gmail.com>2011-08-05 09:43:58 -0400
committerRick Waldron <waldron.rick@gmail.com>2011-08-05 09:43:58 -0400
commit2ce5e95951044ddfc06c3420c7efb1ea1e49134a (patch)
treeaab718d38df6a7139ee96d28d94e2a7fc0d231fb /src/data.js
parent7daf44b5ab1b5fbae9f8cbef9850519433609a12 (diff)
downloadjquery-2ce5e95951044ddfc06c3420c7efb1ea1e49134a.tar.gz
jquery-2ce5e95951044ddfc06c3420c7efb1ea1e49134a.zip
Supports interoperable removal of hyphenated/camelCase properties. Fixes #9413
Diffstat (limited to 'src/data.js')
-rw-r--r--src/data.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/data.js b/src/data.js
index 1e82961fc..279471075 100644
--- a/src/data.js
+++ b/src/data.js
@@ -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