element-factory
v1.5.0
Published
lightweight tool that creates html dom elements out of javascript arrays and objects. Used mainly for templting.
Downloads
4
Readme
Element Factory
What is this?
lightweight element dom element creation tool.
Why?
I wanted to learn how to make a templating system
How do i use this?
The bellow creates a div with the class "red" with a nested span containing "some cool text"
var testEl = elementFactory('div' , {class: 'red'},
elementFactory('div',null,
elementFactory('div',null,
elementFactory('span',{text:'some cool text'})
)
),
);
This is the HTML output
<div class="red">
<div>
<div>
<span>some cool text</span>
</div>
</div>
</div>