how to fix closure compiler error on css({ float: 'left' }) [duplicate]

一个人想着一个人 提交于 2019-12-20 05:40:27

问题


Possible Duplicate:
Google Closure Compiler parse error: invalid property id for css({float:'left'})

I tried to use closure compiler from

http://closure-compiler.appspot.com/home

to compile code

// ==ClosureCompiler==
// @output_file_name default.js
// @compilation_level ADVANCED_OPTIMIZATIONS
// ==/ClosureCompiler==

css({ float: 'left' })

but got error

JSC_PARSE_ERROR: Parse error. invalid property id at line 1 character 6
css({ float: 'left' })

How to fix it? This code is used in Oleg jqGrid createContexMenuFromNavigatorButtons method posted in stackoverflow answer.


回答1:


float is likely to be recognized as a reserved word (although it isn't, it was in ES3), so it should be safe to use

css({ "float": "left"})


来源:https://stackoverflow.com/questions/12553153/how-to-fix-closure-compiler-error-on-css-float-left

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!