More information: node.magic_dom: A DSL for building HTML in node.js
JS code: sys.puts( DIV({id: 'meaning', onclick: 'alert(42)'}, "Meaning") )
Output:
<div id="meaning" onclick="alert(42)">Meaning</div>
JS code:
var link, my_template;
my_template = DIV(
link = A({href: 'http://www.spam.com'}, 'Click me!!!')
)
sys.puts(my_template)
Output:
<div><a href="http://www.spam.com">Click me!!!</a></div>