Skip to main content

Bug Tracker

Side navigation

#8555 closed bug (invalid)

Opened March 17, 2011 08:44PM UTC

Closed March 30, 2011 06:15PM UTC

Last modified March 31, 2011 03:19AM UTC

When attaching multiple event types with one(), function is called once for each event type

Reported by: goulvench@gmail.com Owned by:
Priority: undecided Milestone: 1.next
Component: event Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:
Description

When binding multiple event types at once, the event handler is called ''once for each event type'', instead of one time only as one would expect.

I don't know if this is a bug or a feature, but it might be worth mentioning in the API documentation.

Also, explaining how to remove the event handler would be great too, because calling $(this).unbind(e); doesn't remove it from the other event types.

See the simple testcase for yourself.

Attachments (0)
Change History (4)

Changed March 17, 2011 08:54PM UTC by goulvench comment:1

Using jsFiddle, it appears that all versions of jQuery behave the same in this regard, except 1.2.6 which probably doesn't handle multiple event types being passed as the first argument of one().

Changed March 30, 2011 06:15PM UTC by dmethvin comment:2

component: unfiledevent
keywords: → needsdocs
resolution: → invalid
status: newclosed

We'll document this clearly.

Changed March 30, 2011 06:34PM UTC by cowboy comment:3

You could also try something like this:

https://gist.github.com/894952

Changed March 31, 2011 03:19AM UTC by kswedberg comment:4

keywords: needsdocs