Make mini-skooma more similar to original skooma
This commit is contained in:
parent
b1436e5194
commit
75087c23ca
1 changed files with 11 additions and 2 deletions
13
mini.js
13
mini.js
|
@ -1,7 +1,16 @@
|
|||
export default new Proxy(document, {
|
||||
get: (_, tag) => content => {
|
||||
/** @param {string} tag */
|
||||
get: (_, tag) => /** @param {any[]} args */ (...args) => {
|
||||
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
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue