#13994 closed bug (notabug)
.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.
Change History (2)
comment:1 Changed 10 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
comment:2 Changed 10 years ago by
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.