Create a gist now

Instantly share code, notes, and snippets.

Embed
// compare to: https://github.com/dominictarr/hyperscript/blob/master/index.js (lol)
var e = function(/* tag, attrs, text, children...*/ ) {
var args = [].slice.call(arguments);
var tag = args.shift() || 'div';
var atts = args.shift() || {};
var text = args.shift() || '';
var kids = args;
var el = document.createElement(tag);
Object.keys(atts).forEach(function(k) {
el.setAttribute(k, atts[k]);
});
el.appendChild(document.createTextNode(text));
kids.forEach(function(e) {
el.appendChild(e);
});
return el;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment