HTMLInputElement
Generated from idl/html.webidl when the site was built at 7aa23e2.
HTMLInputElement is an interface in idl/html.webidl, inheriting HTMLElement, exposed in Window. What it does is on MDN; this page says what niso has of it.
Platform notes
Section titled “Platform notes”<input type="checkbox" switch> and <input type="range"> are native controls when their appearance isn’t none; text inputs are native text fields. Other types are plain boxes for now (crates/niso-core/src/controls.rs).
A switch is a SwiftUI Toggle, a range a Slider (hosts/apple/Sources/NodeView.swift).
A switch is a Material 3 Switch, a range a Slider (hosts/android/niso/src/main/kotlin/dev/niso/host/Controls.kt).
A switch is iced’s toggler, a range its slider, a text input text_input (hosts/iced/src/controls.rs).
niso-run lays controls out at the core’s default sizes (a switch 51×31, a slider 160×31) since no host reports native ones.
Status
Section titled “Status”The web features its members belong to, each with its Baseline status on the web and how much of the feature’s WPT suite passes in niso (see Web platform support).
| Feature | On the web | In niso | Members |
|---|---|---|---|
| <input> | Widely available | Partial 35% 428 of 1189 subtests pass | 16 |
| <input type=“number”> | Widely available | Partial 76% 36 of 47 subtests pass | 4 |
| <input type=“checkbox”> | Widely available | Partial 50% 12 of 24 subtests pass | 1 |
Members
Section titled “Members”constructor
Section titled “constructor”[HTMLConstructor] constructor();readonly attribute HTMLFormElement? form;int32_t niso_html_input_element_get_form(niso_dom* dom, niso_handle self, niso_handle* out);attribute DOMString type;int32_t niso_html_input_element_get_type(niso_dom* dom, niso_handle self, niso_str* out);int32_t niso_html_input_element_set_type(niso_dom* dom, niso_handle self, const char* value, size_t value_len);attribute DOMString name;int32_t niso_html_input_element_get_name(niso_dom* dom, niso_handle self, niso_str* out);int32_t niso_html_input_element_set_name(niso_dom* dom, niso_handle self, const char* value, size_t value_len);attribute DOMString value;int32_t niso_html_input_element_get_value(niso_dom* dom, niso_handle self, niso_str* out);int32_t niso_html_input_element_set_value(niso_dom* dom, niso_handle self, const char* value, size_t value_len);defaultValue
Section titled “defaultValue”attribute DOMString defaultValue;int32_t niso_html_input_element_get_default_value(niso_dom* dom, niso_handle self, niso_str* out);int32_t niso_html_input_element_set_default_value(niso_dom* dom, niso_handle self, const char* value, size_t value_len);checked
Section titled “checked”attribute boolean checked;int32_t niso_html_input_element_get_checked(niso_dom* dom, niso_handle self, bool* out);int32_t niso_html_input_element_set_checked(niso_dom* dom, niso_handle self, bool value);A native switch reports the user’s change with niso_dom_control_input, and the host shows the state the next frame sends, which script may have changed or refused (niso_runtime.h).
defaultChecked
Section titled “defaultChecked”attribute boolean defaultChecked;int32_t niso_html_input_element_get_default_checked(niso_dom* dom, niso_handle self, bool* out);int32_t niso_html_input_element_set_default_checked(niso_dom* dom, niso_handle self, bool value);disabled
Section titled “disabled”attribute boolean disabled;int32_t niso_html_input_element_get_disabled(niso_dom* dom, niso_handle self, bool* out);int32_t niso_html_input_element_set_disabled(niso_dom* dom, niso_handle self, bool value);placeholder
Section titled “placeholder”attribute DOMString placeholder;int32_t niso_html_input_element_get_placeholder(niso_dom* dom, niso_handle self, niso_str* out);int32_t niso_html_input_element_set_placeholder(niso_dom* dom, niso_handle self, const char* value, size_t value_len);attribute DOMString min;int32_t niso_html_input_element_get_min(niso_dom* dom, niso_handle self, niso_str* out);int32_t niso_html_input_element_set_min(niso_dom* dom, niso_handle self, const char* value, size_t value_len);attribute DOMString max;int32_t niso_html_input_element_get_max(niso_dom* dom, niso_handle self, niso_str* out);int32_t niso_html_input_element_set_max(niso_dom* dom, niso_handle self, const char* value, size_t value_len);attribute DOMString step;int32_t niso_html_input_element_get_step(niso_dom* dom, niso_handle self, niso_str* out);int32_t niso_html_input_element_set_step(niso_dom* dom, niso_handle self, const char* value, size_t value_len);valueAsNumber
Section titled “valueAsNumber”attribute unrestricted double valueAsNumber;int32_t niso_html_input_element_get_value_as_number(niso_dom* dom, niso_handle self, double* out);int32_t niso_html_input_element_set_value_as_number(niso_dom* dom, niso_handle self, double value);readOnly
Section titled “readOnly”attribute boolean readOnly;int32_t niso_html_input_element_get_read_only(niso_dom* dom, niso_handle self, bool* out);int32_t niso_html_input_element_set_read_only(niso_dom* dom, niso_handle self, bool value);select()
Section titled “select()”undefined select();int32_t niso_html_input_element_select(niso_dom* dom, niso_handle self);selectionStart
Section titled “selectionStart”[NisoGlue] attribute unsigned long? selectionStart;selectionEnd
Section titled “selectionEnd”[NisoGlue] attribute unsigned long? selectionEnd;selectionDirection
Section titled “selectionDirection”attribute DOMString? selectionDirection;int32_t niso_html_input_element_get_selection_direction(niso_dom* dom, niso_handle self, niso_str* out);int32_t niso_html_input_element_set_selection_direction(niso_dom* dom, niso_handle self, const char* value, size_t value_len);setRangeText()
Section titled “setRangeText()”undefined setRangeText(DOMString replacement, optional unsigned long start, optional unsigned long end, optional SelectionMode selectionMode = "preserve");int32_t niso_html_input_element_set_range_text(niso_dom* dom, niso_handle self, const char* replacement, size_t replacement_len, bool has_start, uint32_t start, bool has_end, uint32_t end, const char* selection_mode, size_t selection_mode_len);setSelectionRange()
Section titled “setSelectionRange()”undefined setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);int32_t niso_html_input_element_set_selection_range(niso_dom* dom, niso_handle self, uint32_t start, uint32_t end, const char* direction, size_t direction_len);selectionOffset()
Section titled “selectionOffset()”[NisoInternal] long selectionOffset(boolean end);int32_t niso_html_input_element_selection_offset(niso_dom* dom, niso_handle self, bool end, int32_t* out);selectionStart and selectionEnd (unsigned long?) in the glue: the selection’s start, or with end its end, or -1 where they do not apply.
setSelectionOffset()
Section titled “setSelectionOffset()”[NisoInternal] undefined setSelectionOffset(boolean end, unsigned long offset);int32_t niso_html_input_element_set_selection_offset(niso_dom* dom, niso_handle self, bool end, uint32_t offset);Not in niso yet
Section titled “Not in niso yet”Members the web has, by the BCD keys web-features 3.45.0 lists, that idl/ doesn’t declare. The list is partial: web-features lists only the keys it maps to a feature.
accept(<input>)alpha(alpha and colorspace attributes for <input type=color>)alt(<input>)autocomplete(<input>)cancel event(<input>)capture(HTML media capture)checkValidity(Constraint validation API)colorSpace(alpha and colorspace attributes for <input type=color>)dirName(dirname)files(<input type=“file”>)formAction(<input>)formEnctype(<input>)formMethod(<input>)formNoValidate(<input>)formTarget(<input>)height(<input>)indeterminate(<input type=“checkbox”>)invalid event(<input>)labels(<input>)list(<input>)maxLength(<input>)minLength(<input>)multiple(<input type=“file” multiple>)pattern(<input>)popoverTargetAction(Popover)popoverTargetElement(Popover)reportValidity(Constraint validation API)required(<input>)select event(<input>)selectionchange event(Selection)setCustomValidity(Constraint validation API)showPicker(showPicker() for <input>)size(<input>)src(<input type=“image”>)stepDown(<input type=“number”>)stepUp(<input type=“number”>)validationMessage(Constraint validation API)validity(Constraint validation API)valueAsDate(Date and time <input> types)webkitEntries(<input type=“file” multiple>)webkitdirectory(<input type=“file” webkitdirectory>)width(<input>)willValidate(Constraint validation API)