Re: camelCase for event listeners

On Fri, Apr 11, 2014 at 8:23 AM, Robin Raymond <robin@hookflash.com> wrote:

>
>
> While this is probable low priority "camel vs no camel for events", it's
> better we pick something and stick to it before it's too late.
>
> I guess the pro-camel case argument is:
> - much easier for human readability
> - consistent with remainder of API
>
> and the anti-camel case for events augment is:
> - consistent with "legacy / existing" APIs
> - property vs event is a matter of prepending "on"
>
> I've personally always been more in favor of an API being consistent with
> itself as the #1 goal. I've never much liked the all-lowercase events but I
> knew it was consistent with other APIs when we started drafting the API.
> The property vs event argument by just adding "on" in my mind only has
> merit if converting might be done programmatically vs by a human, as the
> human can know to follow the camel case rules when they code if that is the
> convention.
>
> So do we buck the existing trend and put an end to difficulty in human
> readability? I prefer readable code more than anything and I do not mind
> long method names when it improves readability / understandability. So I'd
> lean toward making everything camel case despite it going somewhat against
> the existing grain.
>
[MB] I fully agree. My guess is also that this will be more readable for
those that are not native English speakers/readers/writers, as I would
expect it's a tad harder for non-native English  speakers/readers/writers
to pick out the separate words when they are all lower case and ensure the
right event name is being used.
[/MB]

>
> -Robin
>
>   Adam Bergkvist <adam.bergkvist@ericsson.com>
>  April 10, 2014 at 1:32 AM
>
>
> Hi
>
> It seems to be a convention among web APIs using DOM events to keep the
> event handler attribute names in all lower case. I agree that it's not the
> prettiest thing in the world. I guess one reason is an other convention to
> have event names, e.g. "canplay" (media element), in lower case and the
> attribute name is simply the result of prepending "on".
>
> BR
> Adam
>
>   cowwoc <cowwoc@bbs.darktech.org>
>  April 7, 2014 at 7:42 PM
> Hi,
>
> In reading http://ortc.org/wp-content/uploads/2014/02/ortc.html I noticed
> that you use camelCase for all identifiers except event listeners, which
> use all-lowercase names. I personally find lowercase names harder to read,
> especially for longer names.
>
> Would you consider changing these to camelCase instead?
>
> Thanks,
> Gili
>
>

Received on Friday, 11 April 2014 15:14:20 UTC