13 KiB
| title | chunk | source | category | tags | date_saved | instance |
|---|---|---|---|---|---|---|
| Enumerated - Glossary | MDN | 1/3 | https://developer.mozilla.org/en-US/docs/Glossary/Enumerated | reference | web, html, css, javascript, documentation | 2026-05-05T05:30:44.790815+00:00 | kb-cron |
MDN HTML HTML: Markup language
HTML reference
HTML guides
Markup languages
CSS reference
CSS guides
Layout cookbook
JavaScriptJS JavaScript: Scripting language
JS reference
JS guides
Web APIs Web APIs: Programming interfaces
Web API reference
Web API guides
- Using the Web animation API
- Using the Fetch API
- Working with the History API
- Using the Web speech API
- Using web workers
Technologies
Topics
Learn Learn web development
Frontend developer course
- Getting started modules
- Core modules
- MDN Curriculum
- Check out the video course from Scrimba, our partner
Learn HTML
Learn CSS
Learn JavaScript
Tools Discover our tools
About Get to know MDN better
Enumerated
In computer science, an enumerated type is a data type consisting of a limited set of named values.
In this article
HTML enumerated attributes
In HTML, enumerated attributes are attributes with a limited, predefined set of text values. For example, the global HTML dir attribute has three valid values: ltr, rtl, and auto. Like for HTML tag names, HTML enumerated attributes and their values are case-insensitive, so LTR, RTL, and AUTO will also work. The IDL-reflected property, HTMLElement.dir, can also be set using a case-insensitive value, but will always return the canonical format of the value defined in the specification (lowercased values in this example). See Attribute reflection for more information.
Each enumerated attribute has a default value for when the attribute is present without a value (the value is missing), and a default value for when the attribute is assigned an invalid value. Unlike Boolean attribute HTML attributes — which are always true when the attribute is present whether the value is present, omitted, or invalid — with enumerated HTML attributes, the default for an omitted value may be different from the default for invalid values. For example, the global HTML contenteditable attribute has two valid keywords: true and false. If the attribute is present but no value is set, the value is true. If a value is set, but is invalid, such as contenteditable="contenteditable", the value maps to a third state, inherit.
ARIA enumerated attributes
ARIA states and properties, being HTML, also have enumerated attributes. If an ARIA attribute includes a both a true and false value in the enumerated list, it generally treats an omitted attribute as false and an invalid value as true, while the default value for the empty string or omitted value depends on the attribute.
For example, the aria-current attribute accepts a limited list of values that includes page, step, location, date, time, true, and false. In this case, if the attribute is not present, is an empty string, is present with no value, or is set to aria-current="false" the attribute is false and is not exposed to the user. Any non-empty string value not in the list of enumerated values is treated as if aria-current="true" were set.
JavaScript enumerable properties
In JavaScript, enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer. Most iteration mechanisms (such as for...in loops and Object.keys) only visit enumerable keys.
See also
- Boolean
- JavaScript data types and data structures
- enumerated attributes in the HTML Standard
- Attribute reflection