#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
Keywords: | 1.7-discuss added |
---|
comment:5 Changed 12 years ago by
Component: | unfiled → event |
---|---|
Milestone: | 1.next → 1.7 |
Priority: | undecided → high |
Status: | new → open |
comment:9 Changed 12 years ago by
Owner: | set to dmethvin |
---|---|
Status: | open → assigned |
comment:11 Changed 12 years ago by
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
comment:13 Changed 12 years ago by
+1, we added something simliar in jQuery UI recently; will this support a hash of event types and handlers as well?
comment:15 Changed 12 years ago by
@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.
Nominating ticket for 1.7 discussion.