Movatterモバイル変換


[0]ホーム

URL:


  1. Glossary
  2. Enumerated

Enumerated

In computer science, anenumerated type is a data type consisting of a limited set of named values.

HTML enumerated attributes

In HTML,enumerated attributes are attributes with a limited, predefined set of text values. For example, the global HTMLdir attribute has three valid values:ltr,rtl, andauto. Like for HTML tag names, HTML enumerated attributes and their values are case-insensitive, soLTR,RTL, andAUTO 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). SeeAttribute 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. UnlikeBoolean 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 HTMLcontenteditable attribute has two valid keywords:true andfalse. If the attribute is present but no value is set, the value istrue. If a value is set, but is invalid, such ascontenteditable="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 atrue andfalse value in the enumerated list, it generally treats an omitted attribute asfalse and an invalid value astrue, while the default value for the empty string or omitted value depends on the attribute.

For example, thearia-current attribute accepts a limited list of values that includespage,step,location,date,time,true, andfalse. In this case, if the attribute is not present, is an empty string, is present with no value, or is set toaria-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 ifaria-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 asfor...in loops andObject.keys) only visit enumerable keys.

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp