Try changing the code in the editor:
// Every tag has the same function:
tagName({attribute : 'value'}, ['content']);
// It's overloaded to accept only content:
tagName(['content']);
// And to accept a String with '#' and/or '.' for attributes
tagName('#id.class', ['content']);
// Content can be an arry of functions returning Strings
// or a single String
tagName([tagName('Single String'), tagName('Single String')])
There are three different ways of rendering DOMsel code
Using with() is frowned upon, but arguably it has the prettier syntax
with(domsel) {
var html = div('#id.class', [
img({src: 'http://i.imgur.com/gnY75e2b.jpg', alt: 'An image'}),
p('.imageText', 'This is text for an image')
]);
}
You can pass a function to domsel's render method
var html = domsel.render(function () {
return div('#id.class', [
img({src: 'http://i.imgur.com/gnY75e2b.jpg', alt: 'An image'}),
p('.imageText', 'This is text for an image')
]);
});
You can also use the domsel object directly for each function call
var html = domsel.div('#id.class', [
domsel.img({src: 'http://i.imgur.com/gnY75e2b.jpg', alt: 'An image'}),
domsel.p('.imageText', 'This is text for an image')
]);
You could also alias domsel to make it more compact
var d = domsel;
var html = d.div('#id.class', [
d.img({src: 'http://i.imgur.com/gnY75e2b.jpg', alt: 'An image'}),
d.p('.imageText', 'This is text for an image')
]);