Skip to content
Permalink
Browse files

Supports interoperable removal of hyphenated/camelCase properties. Fi…

…xes #9413
  • Loading branch information
rwaldron committed Aug 5, 2011
1 parent 7daf44b commit 2ce5e95951044ddfc06c3420c7efb1ea1e49134a
Showing with 14 additions and 2 deletions.
  1. +14 −2 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,

This comment has been minimized.

Copy link
@pomeh

pomeh Nov 4, 2011

I didn't know where to point that out, so I notice you: in the current version of this file, the internalKey is not used anymore, but the jQuery.expando property is accessed multiple times. Could/should we remove that internalKey var or those multiple calls ?

This comment has been minimized.

Copy link
@rwaldron

rwaldron Nov 4, 2011

Author Member

Good catch, I've filed a ticket and pushed up a patch. This shaved 2 bytes of the gzipped source

This comment has been minimized.

Copy link
@pomeh

pomeh Nov 5, 2011

wow ! that was fast ! There's 2 bytes now available to more crazy stuff :)


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

0 comments on commit 2ce5e95

Please sign in to comment.
You can’t perform that action at this time.