Possible Duplicate:
Google Closure Compiler parse error: invalid property id forcss({float:'left'})
我尝试使用闭包编译器
http://closure-compiler.appspot.com/home
编译代码
// ==ClosureCompiler==
// @output_file_name default.js
// @compilation_level ADVANCED_OPTIMIZATIONS
// ==/ClosureCompiler==
css({ float: 'left' })
但出现错误
JSC_PARSE_ERROR: Parse error. invalid property id at line 1 character 6
css({ float: 'left' })
如何解决?此代码在 stackoverflow 答案中发布的 Oleg jqGrid createContexMenuFromNavigatorButtons 方法中使用。
最佳答案
float
很可能被识别为保留字( although it isn't ,它 was in ES3 ),因此应该可以安全使用
css({ "float": "left"})
关于javascript - 如何修复 css({ float : 'left' }),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12553153/