Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#9393 closed enhancement (fixed)

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

Change History (16)

comment:1 Changed 12 years ago by john

Keywords: 1.7-discuss added

Nominating ticket for 1.7 discussion.

comment:2 Changed 12 years ago by Rick Waldron

+1, Absolutely.

comment:3 Changed 12 years ago by jaubourg

+1,

comment:4 Changed 12 years ago by Timmy Willison

+1, yes

comment:5 Changed 12 years ago by Timmy Willison

Component: unfiledevent
Milestone: 1.next1.7
Priority: undecidedhigh
Status: newopen

comment:6 Changed 12 years ago by dmethvin

+1, Genius!

comment:7 Changed 12 years ago by john

+1, Good idea!

comment:8 Changed 12 years ago by maranomynet

+1!

comment:9 Changed 12 years ago by Rick Waldron

Owner: set to dmethvin
Status: openassigned

comment:10 Changed 12 years ago by addyosmani

+1

comment:11 Changed 12 years ago by rpflorence

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

Last edited 12 years ago by rpflorence (previous) (diff)

comment:12 Changed 12 years ago by ajpiano

+1 BLAMMO

comment:13 Changed 12 years ago by scottgonzalez

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

comment:14 Changed 12 years ago by gf3

Hot, Prototype-style, +1.

comment:15 Changed 12 years ago by dmethvin

@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.

comment:16 Changed 12 years ago by dmethvin

Resolution: fixed
Status: assignedclosed

Landed for 1.7.

Note: See TracTickets for help on using tickets.