Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

event names lose quotes when translated to coffeescript #16

Closed
olifante opened this issue Jun 7, 2011 · 5 comments
Closed

event names lose quotes when translated to coffeescript #16

olifante opened this issue Jun 7, 2011 · 5 comments

Comments

@olifante
Copy link

olifante commented Jun 7, 2011

This code:

  ...,
  events: {
    "click button#add": "addItem"
  },
  ...,

Gets translated to something like this:

events: click button#add: "addItem"

Instead of this:

events:
  "click button#add": "addItem"
@rstacruz
Copy link
Member

rstacruz commented Jun 8, 2011

whoa, everytime I run into an error myself, someone's already reported it. thanks! will work on this soon as it's bugging me as well!

reduced example:

x = { 'a.b': c }
x = a.b: c    # <- current behavior
x = 'a.b': c  # <- should be like this

@michaelficarra
Copy link
Contributor

Yeah, you'll have to quote keys with spaces as well: x = { "class A then constructor": function(){} } produces something very different than what is expected.

@rstacruz
Copy link
Member

rstacruz commented Jun 8, 2011

Try it now.
http://ricostacruz.com/js2coffee

@michaelficarra
Copy link
Contributor

Way too many quotes now: ({ "$$": $$ })

@rstacruz
Copy link
Member

rstacruz commented Jun 8, 2011

Thanks! Those edge cases should be taken care of now :)

var hash = {
    a: b,
    'a.a': b,
    'a#a': b,
    'a a': b,
    0: b,
    '0.a': b,
    $: b,
    $$: b,
    $a: b,
    "$a b": b
};

now becomes:

hash = 
  a: b
  "a.a": b
  "a#a": b
  "a a": b
  0: b
  "0.a": b
  $: b
  $$: b
  $a: b
  "$a b": b

clojens pushed a commit to coffeebook/js2coffee that referenced this issue May 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants