I simplified my code to show the problem. When I use this Coffeescript snippet:
$("<div>")
.text "hi"
.appendTo "body"
I expect it to compile like this:
$("<div>").text("hi").appendTo("body")
What it does instead is:
$("<div>").text("hi".appendTo("body"))
I found out that you can keep the brackets and it works, but I guess it's not the way you're supposed to write Coffeescript.
Can anyone tell me how I'm supposed to write it so it compiles to the desired output? Thank you very much.
"hi"and everything is good so far. OK, now we have some white space here that's optional so I can mostly ignore it. OK so we have found a.after the first argument. Well I'm currently parsing arguments so this must be a method call on the"hi"so we begin treating the first argument as a method call.