Created
June 14, 2012 08:42
-
-
Save shaunxcode/2929101 to your computer and use it in GitHub Desktop.
quick coffeescript jquery dsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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