Opened 14 years ago
Closed 14 years ago
#3538 closed bug (fixed)
.unbind() on multiple event types only unbinds first type
Reported by: | JonBob | Owned by: | flesler |
---|---|---|---|
Priority: | major | Milestone: | 1.3 |
Component: | event | Version: | 1.2.6 |
Keywords: | unbind | Cc: | JonBob, kswedberg |
Blocked by: | Blocking: |
Description
Observed in Firefox 3 Mac.
According to the source code comments for .remove():
// Handle multiple events seperated by a space
// jQuery(...).unbind("mouseover mouseout", fn);
This does not appear to actually work; the second event type supplied does nothing. Steps to reproduce in Firebug:
Environment: any page with a visible element (we'll call it <div id="test"></div>
) and jQuery loaded.
$('#test').click(function() { console.log('click'); });
$('#test').dblclick(function() { console.log('dblclick'); });
Now clicks and double-clicks will log the appropriate messages.
$('#test').unbind('click dblclick');
Clicks no longer log messages; double-clicks incorrectly do, though.
Change History (3)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
Cc: | JonBob kswedberg added |
---|---|
need: | Review → Patch |
Owner: | changed from brandon to flesler |
Priority: | minor → major |
Status: | new → assigned |
Will fix this asap.
comment:3 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Okay, here's the problem.
Line 1941 of jquery.js:
for ( handler in events[type] )
The variable
handler
is being reused here. Not a problem if the loop is only executed once, but if there's a second pass through, this clobbers the parameterhandler
and causes the other unbinds to fail.