Remove obsolete files
This commit is contained in:
parent
cd88607ad3
commit
1e47864ee2
1 changed files with 0 additions and 39 deletions
|
@ -1,39 +0,0 @@
|
|||
/**
|
||||
* Creates a new element based on the provided data.
|
||||
*
|
||||
* @param {string} type
|
||||
* The type of the element to create.
|
||||
*
|
||||
* @param {Record<string, any>} attrs
|
||||
* The attributes to add.
|
||||
*
|
||||
* @param {...(Node | string)} children
|
||||
* The children to add to the element.
|
||||
*
|
||||
* @returns {HTMLElement}
|
||||
* The newly created element.
|
||||
*/
|
||||
export function elt(type, attrs, ...children)
|
||||
{
|
||||
let node = document.createElement(type);
|
||||
|
||||
Object.keys(attrs).forEach(
|
||||
key =>
|
||||
{
|
||||
node.setAttribute(key, attrs[key]);
|
||||
});
|
||||
|
||||
for (let child of children)
|
||||
{
|
||||
if (typeof child !== "string")
|
||||
{
|
||||
node.appendChild(child);
|
||||
}
|
||||
else
|
||||
{
|
||||
node.appendChild(document.createTextNode(child));
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
Loading…
Reference in a new issue