utils: append string child directly
Strings can be appended directly without spreading.pull/2/head
parent
380b79038d
commit
5d701c8767
|
@ -13,6 +13,10 @@
|
|||
export function elem(name = 'div', props = {}, children = []) {
|
||||
const el = document.createElement(name);
|
||||
Object.assign(el, props);
|
||||
el.append(...children);
|
||||
if (typeof children === 'string') {
|
||||
el.append(children);
|
||||
} else {
|
||||
el.append(...children);
|
||||
}
|
||||
return el;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue