3 ms·
Here's my "femto-library" for creating DOM dynamically from JS: function ce(tag, attrs={}, children=[]){ var el=document.createElement(tag); for(
by grishka 6y ago
Here's my "femto-library" for creating DOM dynamically from JS:
function ce(tag, attrs={}, children=[]){
var el=document.createElement(tag);
for(var attrName in attrs){
el[attrName]=attrs[attrName];
}
for(var child of children){
el.appendChild(child);
}
return el;
};