问题
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