Skip to content

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.

<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).

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
constructor
[HTMLConstructor] constructor();
attribute
readonly attribute HTMLFormElement? form;
int32_t niso_html_input_element_get_form(niso_dom* dom, niso_handle self, niso_handle* out);
attribute
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
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
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);
attribute
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);
attribute
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).

attribute <input type="checkbox">: Partial 50%
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);
attribute
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);
attribute
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 <input type="number">: Partial 76%
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 <input type="number">: Partial 76%
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 <input type="number">: Partial 76%
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);
attribute <input type="number">: Partial 76%
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);
attribute
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);
operation
undefined select();
int32_t niso_html_input_element_select(niso_dom* dom, niso_handle self);
attribute
[NisoGlue] attribute unsigned long? selectionStart;
attribute
[NisoGlue] attribute unsigned long? selectionEnd;
attribute
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);
operation
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);
operation
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);
operation not in JS
[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.

operation not in JS
[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);

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)