select/optgroup Nesting Rules Check
Checks direct parent relationships for option and optgroup elements in the classic select profile. Customizable selects, datalist options and intervening div elements are outside this explicitly restricted profile.
Description
Classic selects organize options directly under select or under optgroup, while optgroup itself belongs directly under select.
Classic selects organize options directly under select or under optgroup, while optgroup itself belongs directly under select. This restricted structural profile differs from newer customizable-select models.1
The tool returns invalidAt, valid. The fields describe the supplied local pattern or effective state, or contain the formatted markup shown below.
When to use select/optgroup Nesting Rules Check
Use this for the following task: Checks direct parent relationships for option and optgroup elements in the classic select profile. Customizable selects, datalist options and intervening div elements are outside this explicitly restricted profile. Provide the requested local fields extracted from the relevant element or attribute.
How to use select/optgroup Nesting Rules Check and understand its results
- Prepare the parsed element names, attribute values or direct element-child lists requested below. Keep attribute presence separate from its value.
- Enter tags, parents according to the field table, then run the tool.
- Read invalidAt, valid. Check the effective state, recognized-token flags or generated markup against the rules below.
- Correct any reported local mismatch and check the resulting markup in its intended document and browser context.
| Input field | Meaning | Value type and bounds | Requirement |
|---|---|---|---|
| tags | Tags | list of string; minimum entries 0; maximum entries 10000; each entry: maximum text length 10000 | Required |
| parents | Parents | list of string; minimum entries 0; maximum entries 10000; each entry: maximum text length 10000 | Required |
Supply aligned parsed tag and direct-parent name lists. Fold ASCII case and collect zero-based positions violating the chosen relationship; any other tag also fails this profile.
optgroup parent=select; option parent=select or optgroup The symbols and boundary conditions refer to the supplied fields and the implementation described above.
| Output field | Meaning | Value type |
|---|---|---|
| invalidAt | Invalid At | list of integer |
| valid | Valid | boolean |
{
"input": {
"tags": [
"optgroup",
"option",
"optgroup"
],
"parents": [
"select",
"optgroup",
"optgroup"
]
},
"output": {
"invalidAt": [
2
],
"valid": false
}
} Limitations and assumptions
Supply parsed names without angle brackets. Matching folds ASCII uppercase letters without trimming surrounding whitespace. Customizable selects, datalist options and intervening div elements are outside this check. Empty lists pass.
The tool does not fetch a page, run a browser or validate an entire HTML document. Malformed tool requests produce input errors; valid requests can still report unrecognized values or failed local checks.
Alternative or Complementary methods
Choose Input Types Full List Lookup when you need its operation: Looks up all 22 standard input type keywords and resolves unknown or missing values to text. Keyword matching is ASCII case insensitive without trimming. Choose fieldset/legend A11y Pair Check for the complementary operation: Checks a fieldset direct-element-child list for a single legend in first position. A legend is optional in HTML; this check reports the structural pairing without claiming complete accessibility.
Background reference: HTML Standard: select/optgroup Nesting Rules Check.
References
Similar or alternative tools
- Input Types Full List Lookup
Looks up all 22 standard input type keywords and resolves unknown or missing values to text. Keyword matching is ASCII case insensitive without trimming.
- fieldset/legend A11y Pair Check
Checks a fieldset direct-element-child list for a single legend in first position. A legend is optional in HTML; this check reports the structural pairing without claiming complete accessibility.