ACROCase

Acronyms Consistently Retain Original Case

The web platform has hundreds of APIs that contain acronyms. With remarkable consistency, those acronyms are kept uppercase:innerHTML, XMLDocument, toJSON, encodeURIComponent. ACROCase is simply a name for the convention that already exists.

Acronyms in Web APIs

Across the DOM, CSS Object Model, and every major browser API, acronyms retain their original casing. This pattern holds whether the acronym appears at the start, middle, or end of an identifier.

AcronymWeb platform APIs
HTMLHTMLElement, HTMLCollection, innerHTML, outerHTML
CSSCSSStyleSheet, CSSRule, CSSStyleDeclaration
DOMDOMParser, DOMRect, DOMTokenList, DOMException
SVGSVGElement, SVGPathElement, SVGRectElement
URLURL, URLSearchParams, URLPattern, createObjectURL
URIencodeURI, decodeURI, encodeURIComponent
JSONJSON.parse(), JSON.stringify(), toJSON
XMLXMLDocument, XMLSerializer, XMLHttpRequest
GPUGPUDevice, GPUBuffer, GPUTexture, GPUAdapter
RTCRTCPeerConnection, RTCDataChannel, RTCSessionDescription
IDBIDBDatabase, IDBObjectStore, IDBTransaction
USBUSB, USBDevice, USBConfiguration
HIDHID, HIDDevice, HIDConnectionEvent
MIDIMIDIAccess, MIDIInput, MIDIOutput
GATTBluetoothRemoteGATTServer, BluetoothRemoteGATTService
BYOBReadableStreamBYOBReader, ReadableStreamBYOBRequest
VTTVTTCue, VTTRegion
XRXRSystem, XRSession, XRFrame
DTMFRTCDTMFSender, RTCDTMFToneChangeEvent

This is not a handful of cherry-picked examples. There are over a hundred HTML*Element interfaces, over eighty SVG* interfaces, over fifty CSS* interfaces, and over thirty each for GPU*, RTC*, and XR*. The pattern is the default, not the exception.

Abbreviations That Are Not Acronyms

Not everything short is an acronym. The web platform draws a clear line between acronyms (which stay uppercase) and abbreviations (which follow normal casing).

Id

Id is an abbreviation for "identifier," not an acronym. The DOM uses it consistently: getElementById, elementId, clientId, requestId. Writing userID is wrong by web platform convention.

Intl

The Internationalization API is Intl, not INTL. It follows normal PascalCase as an abbreviation, not an acronym.

Where It Breaks Down

The convention is not perfectly consistent. Every exception tells a story about what happens when acronyms collide.

XMLHttpRequest

The most famous API on the web gets its own acronyms wrong.XML is uppercase, but Http is titlecased. By the web platform's own rules, it should be XMLHTTPRequest.

But read XMLHTTP out loud. Where does XML end and HTTP begin? This is the original sin of acronym chaining: two uppercase acronyms next to each other produce an unreadable wall of capitals. The titlecasing of Http was a readability compromise, and it happened so early in the web's history that it became the name everyone knows.

The Web Crypto API

AES, RSA, HMAC, and SHA are universally recognized as acronyms. But the Web Crypto API titlecases all of them:

The same chaining problem drove this decision. Most crypto parameter types combine two acronyms (AES+CBC, RSA+OAEP), and the team chose to titlecase everything for internal consistency rather than mix styles. This means even AesKeyGenParamsis titlecased, where AESKeyGenParams would have been perfectly readable.

WebRTC Sub-Protocols

WebRTC keeps RTC uppercase in every interface name: RTCPeerConnection, RTCDataChannel, RTCDTMFSender. But when a second acronym follows RTC, it gets titlecased:

Unlike the Crypto API, WebRTC only titlecases where chaining actually occurs.RTCDTMF would be unreadable, so RTCDTMFSender is... wait. That one actually keeps DTMF uppercase. The inconsistency runs deep.

The Pattern

Every exception to uppercase acronyms in the web platform exists because two acronyms ended up next to each other. The solution is always the same: titlecase one of them. The convention itself is never in question. The problem is always chaining.

When naming new code, restructure to avoid adjacent acronyms. When that is not possible, titlecasing the second acronym is the established precedent.

The Convention

ACROCase is camelCase with one rule: known acronyms keep their uppercase form.

acroCaseUpperACROCase
Acronym at starturlStringURLString
Acronym at endimageURLImageURL
Multiple acronymshtmlToJSONHTMLToJSON

When an acronym starts a camelCase identifier, it is lowercased like any other first word: urlString, httpRequest, jsonData. In UpperACROCase (PascalCase with acronyms), it stays uppercase: URLString, HTTPRequest, JSONData.

ESLint Plugin

eslint-plugin-acrocase enforces the convention automatically:

npm install eslint-plugin-acrocase --save-dev
{
  "plugins": ["acrocase"],
  "rules": {
    "acrocase/acrocase": "error"
  }
}

The rule is auto-fixable. It ships with a dictionary of 139 acronyms sourced from web platform APIs and common programming usage. Add project-specific acronyms through configuration:

{
  "acrocase/acrocase": ["error", {
    "acronyms": ["GCP", "NATS"]
  }]
}

If you use ESLint's built-in camelcase rule, disable it. It enforces lowercase acronyms, which contradicts the web platform.