6

I'm using Google Closure Compiler application (command line interface). When I run it I get the below error.

deploy/js/Home.js:40: ERROR - Parse error. invalid property id
    this.$images.wrapAll('<div id="slideInner"></div>').css({float:'left'});
                                                                   ^

1 error(s), 0 warning(s)
Christopher Peisert
  • 21,862
  • 3
  • 86
  • 117
Chapsterj
  • 6,483
  • 20
  • 70
  • 124

2 Answers2

9

I believe that you need to do:

{'float':'left'}

This is because float is on the list of Java keywords reserved by JavaScript, so it cannot be used as a property name. This may no longer be an issue in newer JS engines, but it can be a problem in older ones, which is why the Compiler yields an error.

bolinfest
  • 3,710
  • 2
  • 27
  • 40
  • Are *Java* keywords really reserved in Ecmascript - I couldn't find a valid reference? Or is this a JScript issue? – Bergi Sep 25 '12 at 12:33
2

If you already have tons of soy files, and don't want to change everthing in every soy file, you can pass a flag to the compiler:

--compiler_flags="--language_in=ECMASCRIPT5"

It worked out well for me.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Sebastien
  • 21
  • 1