Skip to content
Permalink
Browse files

Fix #10589. Remove deprecated $.fn.data("events") special case.

No unit tests were harmed in the removal of this hack.
  • Loading branch information...
dmethvin committed Jun 11, 2012
1 parent 6af0bcc commit 9e0c056171d1a5cac407f8fedbf926be91eaba1a
Showing with 4 additions and 11 deletions.
  1. +4 −11 src/data.js
@@ -32,7 +32,7 @@ jQuery.extend({
return;
}

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

@@ -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;
}

@@ -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
@@ -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 ) {

0 comments on commit 9e0c056

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