Side navigation
#5563 closed bug (invalid)
Opened November 29, 2009 01:16AM UTC
Closed November 20, 2010 02:40PM UTC
Multiple instances of the same function on an event with different namespaces
Reported by: | Ansman | Owned by: | brandon |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | event | Version: | 1.3.2 |
Keywords: | needsreview event namespace | Cc: | |
Blocked by: | Blocking: |
Description
I was trying to make one element have multiple events of the same function like so:
$('#foo').bind('click.a', bar); $('#foo').bind('click.b', bar);
This is, however, not possible in jQuery, even though they are in different namespaces. I do not know if this is intended or not but either way I think it needs to be fixed.
A temporary solution is to assign anonymous functions:
$('#foo').bind('click.a', function(e){ bar(e); }); $('#foo').bind('click.b', function(e){ bar(e); });
Attachments (0)
Change History (2)
Changed November 29, 2009 01:18AM UTC by comment:1
Changed November 20, 2010 02:40PM UTC by comment:2
keywords: | event, namespace → needsreview event namespace |
---|---|
resolution: | → invalid |
status: | new → closed |
I'm going to mark this working as intended, in most cases you'd want to pass different data for the same function so you could tell the instances apart.
I can also add that the functions where to have different data, otherwise this would not be an issue.
What i was trying to do: