diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2011-08-05 07:44:51 -0700 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2011-08-05 07:44:51 -0700 |
commit | 37254bab91b6e006716029c599bab06792015925 (patch) | |
tree | 5173fa77ec5bb619f01bc0a4eb38ecf0b3cb4282 /src | |
parent | caa47c377474866f9ee3dd869454772d7d70143c (diff) | |
parent | 2ce5e95951044ddfc06c3420c7efb1ea1e49134a (diff) | |
download | jquery-37254bab91b6e006716029c599bab06792015925.tar.gz jquery-37254bab91b6e006716029c599bab06792015925.zip |
Merge pull request #455 from rwldrn/9413
Supports interoperable removal of hyphenated/camelCase properties. Fixes #9413
Diffstat (limited to 'src')
-rw-r--r-- | src/data.js | 16 |
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 |