Skip to content

Instantly share code, notes, and snippets.

@trueadm
Created February 5, 2015 15:12
Show Gist options
  • Save trueadm/898c8f7d7cf89d62f54a to your computer and use it in GitHub Desktop.
Save trueadm/898c8f7d7cf89d62f54a to your computer and use it in GitHub Desktop.
DOM DSL Example #2
template() {
return [
["div",
["header"
["h1", "Example " + this.title]
]
],
['div#main',
$.if(this.todos.length > 0, [
['div',
['span.counter', "There are " + this.todos.length + " todos!"]
]
])
],
['ul.todos',
$.forEach(this.todos, (todo, index) => [
['li.todo',
['h2', "A todo"],
['span', index + ": " + todo]
]
])
],
['form', {id: them.formId, method: "post", action. "#"},
['div.form-control', [
['input', {name: "first_name", type: "text"}]
],
['button', {type: "submit", onClick: this.click},
"Submit!"
]
]
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment