Table of Contents

Class ElementInternals

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The ElementInternals interface of the Document Object Model gives web developers a way to allow custom elements to fully participate in HTML forms. It provides utilities for working with these elements in the same way you would work with any standard HTML form element, and also exposes the Accessibility Object Model to the element.

[Value("ElementInternals")]
public class ElementInternals
Inheritance
ElementInternals
Inherited Members

Remarks

Constructors

ElementInternals()

public ElementInternals()

Properties

Form

The form read-only property of the ElementInternals interface returns the HTMLFormElement associated with this element.

[Value("form")]
public HTMLFormElement? Form { get; }

Property Value

HTMLFormElement

An HTMLFormElement.

Remarks

Labels

The labels read-only property of the ElementInternals interface returns the labels associated with the element.

[Value("labels")]
public NodeList Labels { get; }

Property Value

NodeList

A NodeList containing all of the label elements associated with this element.

Remarks

ShadowRoot

The shadowRoot read-only property of the ElementInternals interface returns the ShadowRoot for this element.

[Value("shadowRoot")]
public ShadowRoot? ShadowRoot { get; }

Property Value

ShadowRoot

A ShadowRoot if the element has a shadow root, otherwise null.

Remarks

States

The states read-only property of the ElementInternals interface returns a CustomStateSet representing the possible states of the custom element.

[Value("states")]
public CustomStateSet States { get; }

Property Value

CustomStateSet

A CustomStateSet which is a {{jsxref("Set")}} of strings.

Remarks

ValidationMessage

The validationMessage read-only property of the ElementInternals interface returns the validation message for the element.

[Value("validationMessage")]
public string ValidationMessage { get; }

Property Value

string

A string containing the validation message of this element.

Remarks

Validity

The validity read-only property of the ElementInternals interface returns a ValidityState object which represents the different validity states the element can be in, with respect to constraint validation.

[Value("validity")]
public ValidityState Validity { get; }

Property Value

ValidityState

A ValidityState object.

Remarks

WillValidate

The willValidate read-only property of the ElementInternals interface returns true if the element is a submittable element that is a candidate for constraint validation.

[Value("willValidate")]
public bool WillValidate { get; }

Property Value

bool

true if the element is a candidate for constraint validation, otherwise false.

Remarks

Elements that are barred from being candidates for constraint validation include those that have the attributes: disabled, hidden or readonly, input elements of type=button or type=reset, or any element that is a datalist element or has a <datalist> element ancestor.

See also on MDN

Methods

CheckValidity()

The checkValidity() method of the ElementInternals interface checks if the element meets any constraint validation rules applied to it.

[Value("checkValidity")]
public bool CheckValidity()

Returns

bool

A boolean value, true if the element meets all validation constraints.

Remarks

If checkValidity returns false then a cancelable invalid event is fired on the element.

See also on MDN

ReportValidity()

The reportValidity() method of the ElementInternals interface checks if the element meets any constraint validation rules applied to it.

[Value("reportValidity")]
public bool ReportValidity()

Returns

bool

A boolean value, true if the element meets all validation constraints.

Remarks

If reportValidity returns false then a cancelable invalid event is fired on the element.

This method behaves in a similar way to CheckValidity(), however it additionally sends the value of ValidationMessage to the user agent for display.

See also on MDN

SetFormValue(Union81?, Union82?)

The setFormValue() method of the ElementInternals interface sets the element's submission value and state, communicating these to the user agent.

[Value("setFormValue")]
public GlobalObject.Undefined SetFormValue(Union81? value, Union82? state = null)

Parameters

value Union81?
state Union82?

Returns

GlobalObject.Undefined

Undefined.

Remarks

SetValidity(ValidityStateFlags, string, HTMLElement)

The setValidity() method of the ElementInternals interface sets the validity of the element.

[Value("setValidity")]
public GlobalObject.Undefined SetValidity(ValidityStateFlags flags = null, string message = null, HTMLElement anchor = null)

Parameters

flags ValidityStateFlags
message string
anchor HTMLElement

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks