constructor
flagrate.createElement
flagrate.createElement([tagName = "div"[, attribute]]) → flagrate.Element
new flagrate.Element
tagName
(String
) – The name of the HTML element to create.attribute
(Object
) – An optional group of attribute/value pairs to set on the element.
Creates an HTML element with tagName
as the tag name, optionally with the given attributes.
Example
// The old way:
var a = document.createElement('a');
a.setAttribute('class', 'foo');
a.setAttribute('href', '/foo.html');
a.appendChild(document.createTextNode("Next page"));
x.appendChild(a);
// The new way:
var a = flagrate.createElement('a', { 'class': 'foo', href: '/foo.html' }).insert("Next page").insertTo(x);