From 9e0c056171d1a5cac407f8fedbf926be91eaba1a Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Mon, 11 Jun 2012 17:16:19 -0400 Subject: [PATCH] Fix #10589. Remove deprecated $.fn.data("events") special case. No unit tests were harmed in the removal of this hack. --- src/data.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/data.js b/src/data.js index 4b5b22fda..e98a77ed4 100644 --- a/src/data.js +++ b/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 ) {