Table of Contents

Class CustomElementRegistry

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The CustomElementRegistry interface provides methods for registering custom elements and querying registered elements. To get an instance of it, use the CustomElements property.

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

Remarks

Constructors

CustomElementRegistry()

public CustomElementRegistry()

Methods

Define(string, CustomElementConstructor, ElementDefinitionOptions)

The define() method of the CustomElementRegistry interface adds a definition for a custom element to the custom element registry, mapping its name to the constructor which will be used to create it.

[Value("define")]
public GlobalObject.Undefined Define(string name, CustomElementConstructor constructor, ElementDefinitionOptions options = null)

Parameters

name string
constructor CustomElementConstructor
options ElementDefinitionOptions

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

Get(string)

The get() method of the
CustomElementRegistry interface returns the constructor for a
previously-defined custom element.

[Value("get")]
public Union80 Get(string name)

Parameters

name string

Returns

Union80

The constructor for the named custom element, or GlobalObject.Undefined if there is no custom element defined with the name.

Remarks

GetName(CustomElementConstructor)

The getName() method of the
CustomElementRegistry interface returns the name for a
previously-defined custom element.

[Value("getName")]
public string? GetName(CustomElementConstructor constructor)

Parameters

constructor CustomElementConstructor

Returns

string

The name for the previously defined custom element, or null if there is no custom element defined with the constructor.

Remarks

Upgrade(Node)

The upgrade() method of the
CustomElementRegistry interface upgrades all shadow-containing custom
elements in a Node subtree, even before they are connected to the main
document.

[Value("upgrade")]
public GlobalObject.Undefined Upgrade(Node root)

Parameters

root Node

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

WhenDefined(string)

The whenDefined() method of the
CustomElementRegistry interface returns a {{jsxref("Promise")}} that
resolves when the named element is defined.

[Value("whenDefined")]
public Task<CustomElementConstructor> WhenDefined(string name)

Parameters

name string

Returns

Task<CustomElementConstructor>

A Promise that fulfills with the custom element&apos;s constructor when a custom element becomes defined with the given name. If a custom element has already been defined with the name, the promise will immediately fulfill.The promise is rejected with a SyntaxError DOMException if the name is not a valid custom element name.

Remarks