Skip to main content

Bug Tracker

Side navigation

#13994 closed bug (notabug)

Opened June 05, 2013 06:00PM UTC

Closed June 05, 2013 06:07PM UTC

Last modified June 05, 2013 06:12PM UTC

.on(events, ...) syntax is not logical

Reported by: WanderingZombie Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.1
Keywords: Cc:
Blocked by: Blocking:

Documentation states "''One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".''".

This is inconsistent with other methods of selecting items, e.g.

$('div p')

selects a <p> descendants of a <div>



selects all <p> and all <div>. So comma = or, space = and.

The ''events'' parameter of ''.on()'' treats comma = ???, space = or.

If the ''events'' parameter of ''.on()'' used comma to delimit events, e.g.

$(something).on('change,keyup', .....

this would be a more consistent and logical way of specifying which events rather than the existing method of using space as a delimiter.

Attachments (0)
Change History (2)

Changed June 05, 2013 06:07PM UTC by timmywil comment:1

resolution: → notabug
status: newclosed

It's not or. It is and. Also, descendent selectors are not and or or, but if you and the ors or or the ands, then you have to and the ands or or the ors, and if you throw in but, it's all over the place.

Space-separated lists are common in js and are not related to selectors.

Changed June 05, 2013 06:12PM UTC by dmethvin comment:2

What timmywil said. Adding that we'd still need to allow spaces, so basically we've just confused things further. And until recently there was no rule that custom event names could not contain a comma.