如何修复css({float:'left'}的闭包编译器错误) [英] how to fix closure compiler error on css({ float: 'left' })
本文介绍了如何修复css({float:'left'}的闭包编译器错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
Google Closure Compiler解析错误:css({float:' left'})的无效属性ID
我尝试使用
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' })
如何解决?这个代码用于Oleg jqGrid中的createContexMenuFromNavigatorButtons方法,发布在stackoverflow的回答中。
How to fix it? This code is used in Oleg jqGrid createContexMenuFromNavigatorButtons method posted in stackoverflow answer.
推荐答案
float
很可能被识别为保留字(虽然它不是' t ,因此位于ES3 ),因此应该安全使用
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"})
这篇关于如何修复css({float:'left'}的闭包编译器错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文