Make mini-skooma more similar to original skooma

This commit is contained in:
Talia 2025-02-07 10:58:39 +01:00
parent b1436e5194
commit 75087c23ca

13
mini.js
View file

@ -1,7 +1,16 @@
export default new Proxy(document, { export default new Proxy(document, {
get: (_, tag) => content => { /** @param {string} tag */
get: (_, tag) => /** @param {any[]} args */ (...args) => {
let node = document.createElement(tag) let node = document.createElement(tag)
for (let key in content) node[key] = content[key] 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]
}
}
}
return node return node
} }
}) })