Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
quick coffeescript jquery dsl
String.prototype.$tag = (args...) ->
args.unshift "<#{@toString()}/>"
$.apply window, args
("ul".$tag
class: "someUL"
html: "li".$tag
text: "some text in an li"
class: "some class"
click: ->
console.log "some click event").appendTo 'body'
#yields <ul class="someUL"><li class="some class">some text in an li</li></ul>
#appended to the body w/ a click event bound to the li.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment