Skip to content

Main content

HTML Option Selected State Reconciliation

Reconcile explicit option selected flags for a static single/multiple select; last selected wins in single mode and first defaults, excluding disabled-option and live-dirty-state behavior.

Loading tool…

Description

Reconcile explicit option selected flags for a static single/multiple select; last selected wins in single mode and first defaults, excluding disabled-option and live-dirty-state behavior.

HTML form controls combine attribute values, option state and form-owner references with browser-maintained DOM state. These tools take explicit strings, lists and flags so a particular relationship can be checked in isolation. The supplied-record model does not itself inspect a document or reproduce every browser state transition.

Reconcile explicit option selected flags for a static single/multiple select; last selected wins in single mode and first defaults, excluding disabled-option and live-dirty-state behavior.

When to use this tool

Use this tool to reconcile explicit option selected flags for a static single/multiple select; last selected wins in single mode and first defaults, excluding disabled-option and live-dirty-state behavior.

How to use the tool and how it works

  1. Enter selected, multiple using the field definitions below.
  2. Run the operation. Correct input errors before interpreting an output.
  3. Read result.selectedIndexes. Use the ordering, boundary rules and absence conditions described below.

For multiple selection, return every flagged index. Otherwise retain the last flagged index, default to index zero for a nonempty unselected list, or return an empty list.1

Input fieldMeaning and unitsAccepted input
selectedBinary 0/1 selection flags in supplied option order.Dense list of at most 128 finite numbers; integer/shape constraints above also apply.
multipleSupplied multiple-selection flag.A boolean true or false.
Output fieldInterpretation
resultObject containing the named fields below.
result.selectedIndexesZero-based option indexes selected under this simplified supplied-state reconciliation rule.
json
{
  "input": {
    "selected": [
      1,
      1,
      0
    ],
    "multiple": false
  },
  "output": {
    "result": {
      "selectedIndexes": [
        1
      ]
    }
  }
}

Limitations and assumptions

  • This is the tool’s simplified supplied-state rule; disabled options, display size, DOM mutation and browser algorithms are not modeled.
  • All DOM-related facts are supplied by the caller. No element is queried, no browser state is mutated and no document-wide validity or accessibility audit is performed.
  • Every declared top-level input field is required and unexpected fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
  • Numeric outputs must be finite and no larger in absolute magnitude than the safe-integer limit; operations returning exact large integers use decimal text. Positions are zero-based and spans end exclusively unless the operation explicitly states a different convention.

Alternative or Complementary methods

Use DOM inspection or browser constraint-validation APIs when actual document state matters. The supplied-record checks are useful for focused audits but do not replace a complete browser algorithm.

References

  1. Tool behavior and example: HTML Option Selected State Reconciliation — tool.io

Similar or alternative tools

  • HTML Select Placeholder Option Check

    Check the supplied select placeholder-label-option conditions for a direct first empty-valued option; no DOM or validation state inference.

  • HTML Form Associated Owner Reference

    Resolve a supplied explicit form attribute before a supplied ancestor form; missing/duplicate owner evidence is retained, no DOM lookup or first-element claim.