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: |
Description
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>
whereas
$('div,p')
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 comment:1
resolution: | → notabug |
---|---|
status: | new → closed |
Changed June 05, 2013 06:12PM UTC by 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.
It's not
or
. It isand
. Also, descendent selectors are notand
oror
, 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 inbut
, it's all over the place.Space-separated lists are common in js and are not related to selectors.