Refactoring, styles, example
This commit is contained in:
4
dom.js
4
dom.js
@@ -19,7 +19,7 @@ class DomHelper {
|
||||
* @param {array|Element|string} children Children or single child/text to apply
|
||||
* @returns Element
|
||||
*/
|
||||
createEl(tag, attr = {}, children = []) {
|
||||
create(tag, attr = {}, children = []) {
|
||||
//console.debug(`create: ${tag}`, attr, children);
|
||||
let el = document.createElement(tag);
|
||||
this.apply(el, attr);
|
||||
@@ -101,7 +101,7 @@ const el = new Proxy(dom, {
|
||||
get(target,name) {
|
||||
return name in target
|
||||
? target[name]
|
||||
: (attr = {}, children = []) => target.createEl(name, attr, children);
|
||||
: (attr = {}, children = []) => target.create(name, attr, children);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user