diff options
author | Corey Frang <gnarf@gnarf.net> | 2011-09-19 16:13:14 -0400 |
---|---|---|
committer | timmywil <timmywillisn@gmail.com> | 2011-09-19 16:13:14 -0400 |
commit | d5f144a7bba98212d6fe9e257f722b62baf651f0 (patch) | |
tree | 6bfa1cb665580a8172abd6b7a6dddeacac9196f0 /src/event.js | |
parent | e4c48a34b4fe687d4a3b935b6c405f502dd0223e (diff) | |
download | jquery-d5f144a7bba98212d6fe9e257f722b62baf651f0.tar.gz jquery-d5f144a7bba98212d6fe9e257f722b62baf651f0.zip |
Landing pull request 500. 1.7 - "public data" stored as a key on "internal data" - Fixes #8921.
More Details:
- https://github.com/jquery/jquery/pull/500
- http://bugs.jquery.com/ticket/8921
Diffstat (limited to 'src/event.js')
-rw-r--r-- | src/event.js | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/event.js b/src/event.js index 363448b60..2617382ad 100644 --- a/src/event.js +++ b/src/event.js @@ -247,11 +247,10 @@ jQuery.event = { } delete elemData.events; - delete elemData.handle; - if ( jQuery.isEmptyObject( elemData ) ) { - jQuery.removeData( elem, undefined, true ); - } + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete for this last property we touch here + jQuery.removeData( elem, "handle", true ); } } }, @@ -326,17 +325,14 @@ jQuery.event = { // Handle a global trigger if ( !elem ) { + // TODO: Stop taunting the data cache; remove global events and always attach to document - jQuery.each( jQuery.cache, function() { - // internalKey variable is just used to make it easier to find - // and potentially change this stuff later; currently it just - // points to jQuery.expando - var internalKey = jQuery.expando, - internalCache = this[ internalKey ]; - if ( internalCache && internalCache.events && internalCache.events[ type ] ) { - jQuery.event.trigger( event, data, internalCache.handle.elem ); + var cache = jQuery.cache; + for ( i in cache ) { + if ( cache[ i ].events && cache[ i ].events[ type ] ) { + jQuery.event.trigger( event, data, cache[ i ].handle.elem ); } - }); + } return; } |