From 2ce5e95951044ddfc06c3420c7efb1ea1e49134a Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Fri, 5 Aug 2011 09:43:58 -0400 Subject: [PATCH] Supports interoperable removal of hyphenated/camelCase properties. Fixes #9413 --- src/data.js | 16 ++++++++++++++-- 1 file 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 -- 2.39.5