CreateElement method
Creates an element based on the provided elementDescriptor object. In the engine, it is used to dynamically add the frame’s stylesheet and script file.
CreateElement(elementDescriptor);
Parameters
elementDescriptor
: object
The description of the element:
{
name: string,
parent?: DOMElement,
classList?: string[],
id?: string,
innerHTML?: string,
attributes?: object[],
}
Examples
The example creates a script element to load in the theme’s script file as a module:
CreateElement({
parent: $("body"),
name: "script",
attributes: [
{src: "frame.js"},
{type: "module"},
],
});
Result
<script class="" id="" src="frame.js" type="module"></script>