Skip to main content

Bug Tracker

Side navigation

#9393 closed enhancement (fixed)

Opened May 22, 2011 07:15PM UTC

Closed September 20, 2011 12:52PM UTC

Last modified March 08, 2012 11:59PM UTC

Unify and DRY out event system

Reported by: dmethvin Owned by: dmethvin
Priority: high Milestone: 1.7
Component: event Version: 1.6.1
Keywords: 1.7-discuss Cc:
Blocked by: Blocking:
Description

Unify and DRY out event system: jQuery.fn.on(events, [, selector ] [, data ], handler) -- see https://docs.google.com/document/d/1vzJ_pl_bCKAisHu15DhTQkJBNGvgycW35lJW45d9P6U/edit?hl=en

Attachments (0)
Change History (16)

Changed May 22, 2011 07:27PM UTC by john comment:1

keywords: → 1.7-discuss

Nominating ticket for 1.7 discussion.

Changed May 22, 2011 08:31PM UTC by rwaldron comment:2

+1, Absolutely.

Changed May 23, 2011 01:04AM UTC by jaubourg comment:3

+1,

Changed May 23, 2011 05:07AM UTC by timmywil comment:4

+1, yes

Changed May 24, 2011 12:58AM UTC by timmywil comment:5

component: unfiledevent
milestone: 1.next1.7
priority: undecidedhigh
status: newopen

Changed May 24, 2011 10:24PM UTC by dmethvin comment:6

+1, Genius!

Changed June 03, 2011 02:10PM UTC by john comment:7

+1, Good idea!

Changed June 03, 2011 03:52PM UTC by maranomynet comment:8

+1!

Changed June 04, 2011 04:27PM UTC by rwaldron comment:9

owner: → dmethvin
status: openassigned

Changed June 04, 2011 10:18PM UTC by addyosmani comment:10

+1

Changed June 05, 2011 02:00PM UTC by rpflorence comment:11

_comment0: Not sure if these even needs to be addressed, possibly only documented, but some might expect `trigger` to work on events added this way, but trigger doesn't really work with event delegation. Could cause some confusion that trigger works with `el.on('click', fn)` but not with `el.on('click', 'li > a', fn)`. \ \ MooTools delegates by parsing the event name with a CSS style pseudo selector. So something like el.on('click:relay(li > a)', fn). \ \ Makes for a simpler signature and then you could trigger 'click:relay(li > a)' and pass in a fake target to get trigger to work with this unified system, even with delegation. Just a thought, but I don't think it's all that important /shrug \ \ \ 1307285280627322

Not sure if this even needs to be addressed, possibly only documented, but some might expect trigger to work on events added this way, but trigger doesn't really work with event delegation. Could cause some confusion that trigger works with el.on('click', fn) but not with el.on('click', 'li > a', fn).

MooTools delegates by parsing the event name with a CSS style pseudo selector. So something like el.on('click:relay(li > a)', fn).

Makes for a simpler signature and then you could trigger 'click:relay(li > a)' and pass in a fake target to get trigger to work with this unified system, even with delegation. Just a thought, but I don't think it's all that important /shrug

Changed June 05, 2011 10:14PM UTC by ajpiano comment:12

+1 BLAMMO

Changed June 06, 2011 03:36PM UTC by scottgonzalez comment:13

+1, we added something simliar in jQuery UI recently; will this support a hash of event types and handlers as well?

Changed August 11, 2011 03:46AM UTC by gf3 comment:14

Hot, Prototype-style, +1.

Changed August 11, 2011 01:55PM UTC by dmethvin comment:15

@gf3, the history of .on goes back to prehistoric days, I didn't realize Prototype had done it until after I had come up with the proposal. It's good to have some consistency across frameworks though.

Changed September 20, 2011 12:52PM UTC by dmethvin comment:16

resolution: → fixed
status: assignedclosed

Landed for 1.7.