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

Semicolon replaced by comma when using dollar sign (jquery) #34

Closed
charlesbdudley opened this issue Aug 8, 2012 · 2 comments
Closed

Comments

@charlesbdudley
Copy link

Original Code:

$( 'body' ).css('background','red');
$( 'div' ).css('background','blue');

Uglified Code:

$(\"body\").css(\"background\",\"red\"),$(\"div\").css(\"background\",\"blue\");

Notice the comma added before $(\"div\")

@lautis
Copy link
Owner

lautis commented Aug 8, 2012

Using commas to separate statements instead of semicolons is valid ECMAScript, even though some implementations do have issues with it. Check out http://my.opera.com/hallvors/blog/2012/07/17/twitter-crashes-itself-with-commas.

@charlesbdudley
Copy link
Author

Ah, thanks @lautis. Setting :seqs => false gets around this.

Uglifier.new(:seqs => false).compile(File.read("app/assets/javascripts/temp3.js"))
=> "$(\"body\").css(\"background\",\"red\");$(\"div\").css(\"background\",\"blue\");"

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