possible bug in event code

possible bug in event code


I was getting a memory leak in IE when I was attaching more than one
event handler to an element. So the following code would cause a
leak:
$('#adiv').click(function () { }).
dblclick(function () { }).
unbind().
remove();
After some debugging I suspect that jQuery.event.add has a bug in it.
The code for 1.2.1 on line 1611
var handle = jQuery.data(element, "handle", function () {
should instead be
var handle = jQuery.data(element, "handle") || jQuery.data(element,
"handle", function () {
It looks like the code was always creating a new handle for each event
added instead of getting an existing handle out of the cache when it
was already there. My thought is that was why one event worked fine,
but two failed.
Does that make sense?
David