diff --git a/mini.js b/mini.js index f4cecb1..36f2aeb 100644 --- a/mini.js +++ b/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 } })