CustomElementRegistry Class

https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry: defines custom elements with .NET constructors (see CustomElementConstructor).

public sealed class CustomElementRegistry

Remarks

The document of a BrowsingContext has a global registry (Window.CustomElements). Other documents (parsed without a browsing context, DOMParser, createHTMLDocument()...) have no registry: use a scoped registry (new CustomElementRegistry()) and CustomElementRegistry.Initialize, or HtmlParserOptions.CustomElementRegistry.

See also

Constructors

NameDescription
CustomElementRegistry()Creates a scoped registry (https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry).

CustomElementRegistry()

CustomElementRegistry.cs

Creates a scoped registry (https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry).

public CustomElementRegistry()

Properties

NameDescription
IsScopedhttps://html.spec.whatwg.org/multipage/custom-elements.html#is-scoped

https://html.spec.whatwg.org/multipage/custom-elements.html#is-scoped

public bool IsScoped { get; }

Property value

bool

Methods

NameDescription
Define(string, CustomElementConstructor, ElementDefinitionOptions?)https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry-define
Get(string)https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry-get
GetName(CustomElementConstructor)https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry-getname
Initialize(Node)https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry-initialize
Upgrade(Node)https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry-upgrade
WhenDefined(string)https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry-whendefined. The task completes synchronously when the element is defined, like the promise is resolved by define().

Define(string, CustomElementConstructor, ElementDefinitionOptions?)

CustomElementRegistry.cs

https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry-define

public void Define(string name, CustomElementConstructor constructor, ElementDefinitionOptions? options = null)

https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry-get

GetName(CustomElementConstructor)

CustomElementRegistry.cs

https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry-getname

public string? GetName(CustomElementConstructor constructor)

Initialize(Node)

CustomElementRegistry.cs

https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry-initialize

public void Initialize(Node root)

https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry-upgrade

public void Upgrade(Node root)

WhenDefined(string)

CustomElementRegistry.cs

https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry-whendefined. The task completes synchronously when the element is defined, like the promise is resolved by define().

public Task<CustomElementConstructor> WhenDefined(string name)