mirror of
https://github.com/TecharoHQ/anubis.git
synced 2026-04-14 04:28:49 +00:00
@@ -5,7 +5,9 @@
|
||||
*/
|
||||
const h = (name, data = {}, children = []) => {
|
||||
const result =
|
||||
typeof name == "function" ? name(data) : Object.assign(document.createElement(name), data);
|
||||
typeof name == "function"
|
||||
? name(data)
|
||||
: Object.assign(document.createElement(name), data);
|
||||
if (!Array.isArray(children)) {
|
||||
children = [children];
|
||||
}
|
||||
@@ -118,10 +120,10 @@ const d = (ms) => {
|
||||
/**
|
||||
* Parse the contents of a given HTML page element as JSON and
|
||||
* return the results.
|
||||
*
|
||||
*
|
||||
* This is useful when using templ to pass complicated data from
|
||||
* the server to the client via HTML[1].
|
||||
*
|
||||
*
|
||||
* [1]: https://templ.guide/syntax-and-usage/script-templates/#pass-server-side-data-to-the-client-in-a-html-attribute
|
||||
*/
|
||||
const j = (id) => JSON.parse(g(id).textContent);
|
||||
|
||||
Reference in New Issue
Block a user