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
namestringconstructorCustomElementConstructoroptionsElementDefinitionOptions
Returns
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
namestring
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
constructorCustomElementConstructor
Returns
- string
The name for the previously defined custom element, or
nullif 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
rootNode
Returns
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
namestring
Returns
- Task<CustomElementConstructor>
A Promise that fulfills with the custom element'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
SyntaxErrorDOMException if the name is not a valid custom element name.