Skip to content

0.2.2 u elements

Ivan S Glazunov edited this page Feb 20, 2015 · 3 revisions

Elements?

Elements are called heirs extensions of Prototype.

We recommend the following elements:


[new] (...arguments: Array<TData>) => this;

Data management without the container tag.

var content = Templates.content;

content('content').render(console.log); // content

[new] (...arguments: Array<IAttributes|TSelector>) => this;

Collection of single tags.

var singles = Templates.singles;
var img = singles.img;

img('.radius').render(console.log); // <img class="radius"/>
img('.radius[src=image.jpg]').render(console.log); // <img class="radius" src="image.jpg"/>
img('.radius', { src: 'image.jpg' }).render(console.log); // <img class="radius" src="image.jpg"/>
content(img).render(console.log); // <img/>
content(img('.radius')).render(console.log); // <img class="radius"/>

[new] (...arguments: Array<IAttributes|TSelector>) => .content => this;

Collection of double tags.

var doubles = Templates.doubles;
var div = doubles.div;

div('.container')('content').render(console.log); // <div class="container">content</div>
content(div('.container')).render(console.log); // <div class="container"></div>
content(div).render(console.log); // <div></div>

[new] (...arguments: Array<IAttributes|TSelector>) => this;

Collection doctype tag.

var doctype = Templates.doctypes;

content(doctype.html).render(console.log); // <!DOCTYPE html>
doctype.html().render(console.log); // <!DOCTYPE html>
doctype.html('[PUBLIC]').render(console.log); // <!DOCTYPE html PUBLIC>
doctype.html({ PUBLIC: null }).render(console.log); // <!DOCTYPE html PUBLIC>

Clone this wiki locally