Created
May 4, 2011 17:29
-
-
Save tomfaulhaber/955623 to your computer and use it in GitHub Desktop.
Multi-line, multi-lambdas in coffeescript?
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
# I want to be able to spread multiple lambda args across multiple lines, but | |
# I'm unclear on the syntax | |
# The following gives me | |
# "Error: In XXX/dashboard.coffee, Parse error on line 125: Unexpected ','" | |
# whether I put it on one line or multiple lines. | |
$("ul.topnav > li").hover( | |
( -> $(this).find("span").addClass "subhover"), | |
( -> $(this).find("span").removeClass "subhover")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems like the above syntax works, but things fail when the lambdas are themselves split. To get it to be reliable, I needed to put the closing paren for the hover call on its own line.