This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27317 - Provide explicit guidance on enum value naming
Summary: Provide explicit guidance on enum value naming
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: WebIDL (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Cameron McCormack
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-13 17:50 UTC by David Dorwin
Modified: 2015-07-07 06:20 UTC (History)
9 users (show)

See Also:


Attachments

Description David Dorwin 2014-11-13 17:50:20 UTC
It is not clear from http://heycam.github.io/webidl/#idl-enums how spec authors should name enum values, especially those that are composed of more than one word. The examples are all single words. "enumeration-values" might imply that dashes should be used to separate the words, but there seems to be uncertainty on this [1][2].

Please provide explicit guidance, including case and whether/how to separate words.

Existing and active specs are inconsistent but seem to tend toward use of dashes:
- Fetch is using a mix of concatenation and dashes:
   https://fetch.spec.whatwg.org/#requestcontext
- Screen Orientation is using dashes:
   https://w3c.github.io/screen-orientation/#orientationtype-enum
- Web Audio has one of each:
   http://webaudio.github.io/web-audio-api/
- WebRTC uses dashes:
   http://www.w3.org/TR/webrtc/

[1] http://lists.w3.org/Archives/Public/public-script-coord/2013OctDec/0184.html
[2] http://lists.w3.org/Archives/Public/public-script-coord/2014OctDec/0147.html
Comment 1 Brian Birtles 2014-11-13 23:49:05 UTC
And in Web Animations we use dashes to match the corresponding CSS keywords:

  http://w3c.github.io/web-animations/#the-playbackdirection-enumeration
Comment 2 David Dorwin 2014-11-18 21:53:21 UTC
Can we definitively say whether there is a preference for dashes for new specs? I need to add some multi-word names to a spec, so it would be nice to know what is preferred. Thanks.
Comment 3 Joe Steele 2014-12-09 22:04:23 UTC
Ping. This is blocking at least one bug in EME we would like to resolve.
Comment 4 Domenic Denicola 2014-12-09 22:25:19 UTC
I have a slight preference for using dashes (or spaces, but probably too late for that) when we can.

Who else should weigh in here? We should get some advice added to the spec if there's agreement.
Comment 5 Tab Atkins Jr. 2014-12-09 22:33:39 UTC
Yeah, let's just settle on dashes. More readable, and CSS is definitely going to be using dashes for anything they need.
Comment 6 Henri Sivonen 2015-01-15 12:54:37 UTC
I'd like to request that this bikeshed be painted to completion ASAP. I can live with dashes.
Comment 7 Anne 2015-01-15 12:59:50 UTC
I think the conclusion is lowercase and either dashes or single word depending on the circumstances (e.g. ArrayBuffer becomes "arraybuffer", not "array-buffer"). I recommend going with that as a general guideline for now. It will likely take some time before IDL is updated.