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

wrong translation for "for in" without brackets #284

Closed
ASnow opened this issue May 16, 2014 · 3 comments
Closed

wrong translation for "for in" without brackets #284

ASnow opened this issue May 16, 2014 · 3 comments

Comments

@ASnow
Copy link

ASnow commented May 16, 2014

js input:

for ( i in attributes ) 
  html.push( i + '="' + CKEDITOR.tools.htmlEncode( attributes[ i ] ) + '" ' );

coffee output:

for i of attributes
  continue

solution my situation can be wrap "for" into brackets, but in general it not comfortable.

@timaschew
Copy link
Member

@ASnow
Copy link
Author

ASnow commented Aug 22, 2014

Can't understand how that is a feature of coffeescript?
we have same pure js code

// Example 1
for ( i in attributes ) 
  html.push( i + '="' + CKEDITOR.tools.htmlEncode( attributes[ i ] ) + '" ' );  
// Example 2
for ( i in attributes ) {
  html.push( i + '="' + CKEDITOR.tools.htmlEncode( attributes[ i ] ) + '" ' );
}

and got different answers

# Example 1 (wrong)
for i of attributes
  continue # should be `html.push i + "=\"" + CKEDITOR.tools.htmlEncode(attributes[i]) + "\" "`

# Example 2
for i of attributes
  html.push i + "=\"" + CKEDITOR.tools.htmlEncode(attributes[i]) + "\" "

@timaschew
Copy link
Member

sorry, misunderstood it ;)

@timaschew timaschew reopened this Aug 22, 2014
@timaschew timaschew changed the title wrong translation for "for without brackets" wrong translation for "for in without brackets" Aug 23, 2014
@timaschew timaschew changed the title wrong translation for "for in without brackets" wrong translation for "for in" without brackets Aug 23, 2014
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

2 participants