Giter Club home page Giter Club logo

Comments (7)

liamoc avatar liamoc commented on July 23, 2024

His example actually puts each property access on a newline -- markdown fail.

from coffeescript.

jashkenas avatar jashkenas commented on July 23, 2024

CoffeeScript already supports this -- you just need to end the line with the dot operator, instead of beginning it, indicating to the parser that the line isn't finished. (No semicolons, folks). Currently, this:

$(".team").
  find("player").
  animate("slow").
  highlight().
  css("color","#ff0000")

Compiles into:

$(".team").find("player").animate("slow").highlight().css("color", "#ff0000");

Closing the ticket.

from coffeescript.

francescoagati avatar francescoagati commented on July 23, 2024

i try but i give this error:
line 1: syntax error for '.'

i use the gem version. should be this the problem. thanks

from coffeescript.

jashkenas avatar jashkenas commented on July 23, 2024

Yes. The gem is pretty far behind at this point -- I don't want to push out a new one until CoffeeScript 0.2.0, which includes significant whitespace, along with a host of other improvements (ideally later today).

For now, you can checkout the source (master branch), and run rake gem:install to build yourself a fresher version of CoffeeScript.

from coffeescript.

weepy avatar weepy commented on July 23, 2024

Is there a particular reason that CS can't support

$(".team")
  .find("player")
  .css("top")

It's a preferable style, as otherwise the notion of the function call is separated over two lines.

from coffeescript.

jashkenas avatar jashkenas commented on July 23, 2024

Alright weepy, francesco --

jQuery-style multiline calls are now possible on master. Weepy's last example compiles into this:

$(".team").find("player").css("top");

The lexer just needs to peek at the next character, before it decides to tokenize a newline.

from coffeescript.

weepy avatar weepy commented on July 23, 2024

Wooop!

from coffeescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.