2024-09-07 06:54:25 +00:00
|
|
|
export default new Proxy(document, {
|
2025-02-07 09:58:39 +00:00
|
|
|
/** @param {string} tag */
|
|
|
|
get: (_, tag) => /** @param {any[]} args */ (...args) => {
|
2024-09-07 06:54:25 +00:00
|
|
|
let node = document.createElement(tag)
|
2025-02-07 09:58:39 +00:00
|
|
|
for (const arg of args) {
|
|
|
|
if (arg instanceof HTMLElement) {
|
|
|
|
node.append(arg)
|
|
|
|
} else if (arg instanceof Object) {
|
|
|
|
for (let key in arg) {
|
|
|
|
node[key] = arg[key]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-09-07 06:54:25 +00:00
|
|
|
return node
|
|
|
|
}
|
|
|
|
})
|