Skip to content

Commit

Permalink
Fix #10589. Remove deprecated $.fn.data("events") special case.
Browse files Browse the repository at this point in the history
No unit tests were harmed in the removal of this hack.
  • Loading branch information
dmethvin committed Jun 11, 2012
1 parent 6af0bcc commit 9e0c056
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jQuery.extend({
return;
}

var privateCache, thisCache, ret,
var thisCache, ret,
internalKey = jQuery.expando,
getByName = typeof name === "string",

Expand All @@ -46,12 +46,11 @@ jQuery.extend({

// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey,
isEvents = name === "events";
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;

// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
return;
}

Expand Down Expand Up @@ -85,7 +84,7 @@ jQuery.extend({
}
}

privateCache = thisCache = cache[ id ];
thisCache = cache[ id ];

// jQuery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
Expand All @@ -102,12 +101,6 @@ jQuery.extend({
thisCache[ jQuery.camelCase( name ) ] = data;
}

// Users should not attempt to inspect the internal events object using jQuery.data,
// it is undocumented and subject to change. But does anyone listen? No.
if ( isEvents && !thisCache[ name ] ) {
return privateCache.events;
}

// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( getByName ) {
Expand Down

0 comments on commit 9e0c056

Please sign in to comment.