I think the problem is using single line // comments. The single-line comments enclosed in /* .. */ seem to work fine. Here is an equivalent example with something other than a comment.
$('element').hover( -> console.log("first") -> console.log("second") )
Or with comments using /* .. */ .
$('element').hover( -> -> )
You can try these examples on the Try CoffeeScript tab. CoffeeScript adds a return statement to return the last expression of the function. If you need bare-bones functions that do nothing and do not contain return at the end, try:
$('element').hover( () -> () -> ) // $('element').hover(function() {}, function() {});
Anurag Jun 25 '11 at 2:21 2011-06-25 02:21
source share