Google Closure Compiler解析错误:`css({float:'left'})`的无效属性id [英] Google Closure Compiler parse error: invalid property id for `css({float:'left'})`

查看:155
本文介绍了Google Closure Compiler解析错误:`css({float:'left'})`的无效属性id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google Closure Compiler应用程序(命令行界面)。当我运行它时,我得到以下错误。

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)


推荐答案

我相信你需要这样做:

{'float':'left'}

这是因为 float JavaScript保留的Java关键字列表上,因此不能用作属性名称。这可能不再是新JS引擎中的问题,但它可能是旧版本中的问题,这就是编译器产生错误的原因。

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.

这篇关于Google Closure Compiler解析错误:`css({float:'left'})`的无效属性id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆