Custom Element Dash-Name Requirement
Validates custom-element names using the current HTML and DOM local-name rules: initial ASCII lowercase, a dash, no ASCII uppercase or forbidden local-name characters, and no reserved SVG/MathML names. This does not check registry availability.
Description
Custom element names distinguish application-defined elements from built-in names.
Custom element names distinguish application-defined elements from built-in names. A dash is necessary but other local-name requirements and reserved names also apply.1
Validates custom-element names using the current HTML and DOM local-name rules: initial ASCII lowercase, a dash, no ASCII uppercase or forbidden local-name characters, and no reserved SVG/MathML names. This does not check registry availability.
When to use Custom Element Dash-Name Requirement
Use this for the following task: Validates custom-element names using the current HTML and DOM local-name rules: initial ASCII lowercase, a dash, no ASCII uppercase or forbidden local-name characters, and no reserved SVG/MathML names. This does not check registry availability.
Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.
How to use Custom Element Dash-Name Requirement and understand its results
- Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.
- Enter name using the field table, then run the tool.
- Read valid, containsDash, reserved. Interpret flags, units, ordering and placeholder values using the rules below.
- Review any reported issue or failed check, correct the supplied values when appropriate, and verify the result in its intended context.
| Input field | Meaning | Value type and bounds | Requirement |
|---|---|---|---|
| name | Name | string; maximum text length 1000 | Required |
Check the exact supplied name. Reject ASCII uppercase, null, ASCII whitespace, slash, greater-than and the eight reserved SVG/MathML names; report dash presence and reservation separately.2
valid = initial ASCII lowercase AND dash AND allowed local-name characters AND !reserved This summarizes the declared operation. Units, indexing, inclusivity and exceptional cases are explained in the surrounding text.
| Output field | Meaning | Value type |
|---|---|---|
| valid | Valid | boolean |
| containsDash | Contains Dash | boolean |
| reserved | Reserved | boolean |
{
"input": {
"name": "weather-panel"
},
"output": {
"valid": true,
"containsDash": true,
"reserved": false
}
} Limitations and assumptions
This does not check registry availability or construct an element. The implemented current local-name check should not be replaced with an older restricted-name regex.
This evaluates supplied local information; it does not fetch a page or run a browser. Malformed requests produce input errors. A successfully evaluated request can still contain false flags, empty result lists or a result outside the supplied threshold; those outcomes have the meanings stated above.
Alternative or Complementary methods
Choose data-* Attribute Naming Validator for this operation: Validates a namespace-less DOM data-* attribute local name and derives its dataset property name. Supply the DOM name after any HTML parser lowercasing. For a complementary task, use slot name Fallback Shadow DOM Lookup for this operation: Resolves automatic named slot assignment from direct host slotable names. The first slot with a given name receives matching nodes; later same-name slots display fallback. Text nodes use the empty default name. Manual assignment is outside this profile.
Further background: HTML / accessibility reference: Custom Element Dash-Name Requirement.
References
Similar or alternative tools
- data-* Attribute Naming Validator
Validates a namespace-less DOM data-* attribute local name and derives its dataset property name. Supply the DOM name after any HTML parser lowercasing.
- slot name Fallback Shadow DOM Lookup
Resolves automatic named slot assignment from direct host slotable names. The first slot with a given name receives matching nodes; later same-name slots display fallback. Text nodes use the empty default name. Manual assignment is outside this profile.