tweak tag export function

This commit is contained in:
Geoff Doty 2024-05-22 12:02:58 -04:00
parent 9bb54e38fe
commit 4760c611a3
2 changed files with 8 additions and 7 deletions

View File

@ -1,6 +1,5 @@
import tag from "./tag.js"; import h from "./tag.js";
import app from "./app.js"; import app from "./app.js";
export {app}; export {app};
/** exports tag as h */ export {h};
export const h = tag;

View File

@ -1,12 +1,14 @@
/** /**
* Creates new DOM element(s) from tag name(s) and attributes * HTML Tag Scripting Function
* *
* @param {string} tag - tag to create * creates new DOM element(s) from tag name(s) and attributes
* @param {...any} args - attributes and/or child tag elements *
* @param {String} tag - tag to create
* @param {*} args - attributes and/or child tag elements
* *
* @returns {HTMLElement} The created DOM element(s) * @returns {HTMLElement} The created DOM element(s)
*/ */
export default function tag(tag, ...args) { export default function h(tag, ...args) {
const el = document.createElement(tag); const el = document.createElement(tag);
// support all scalar values as TextNodes // support all scalar values as TextNodes