admin管理员组文章数量:1313121
I'm using Google Closure Compiler application (mand 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)
I'm using Google Closure Compiler application (mand 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)
Share
Improve this question
edited Sep 23, 2012 at 18:45
Christopher Peisert
24.2k3 gold badges101 silver badges126 bronze badges
asked Jul 7, 2011 at 14:03
ChapsterjChapsterj
6,63521 gold badges73 silver badges124 bronze badges
2
-
Have you tried putting the key in quotes ?
.css({'float':'left'})
? – Gabriele Petrioli Commented Jul 7, 2011 at 14:10 - Note that I've seen unquoted keywords used as this cause errors in IE, so it's a good thing to fix anyway :) – Michael Mior Commented Jul 7, 2011 at 14:16
2 Answers
Reset to default 9I 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.
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 piler:
--piler_flags="--language_in=ECMASCRIPT5"
It worked out well for me.
版权声明:本文标题:javascript - Google Closure Compiler parse error: invalid property id for `css({float:'left'})` - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741938841a2406020.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论