当谷歌通过名为Closure Compiler的便捷工具中缩小JavaScript时,它会出现以下错误(并且不会缩小某个内容):
错误数:1 JSC_TRAILING_COMMA:解析错误。 IE8(及以下) 将错误地解析数组和对象文字中的尾随逗号。 如果您要定位较新版本的JS,请设置相应的版本 language_in选项。在all.js的第389行第1号
theme : 'default', // The theme of the slider (default, theme1, theme2, t...
$(window).load(function(){
jQuery('#slider1').autoSlider({
theme : 'default', // The theme of the slider (default, theme1, theme2, theme3)
width : '960', // The width of the slider, 100% for auto full width, set to 0 it will take the width of the largest image
autoHidePlayBtn : true, //
答案 0 :(得分:8)
错误(因为害怕简单地重写Closure Compiler错误所说的内容)是IE8及以下版本无法解析具有尾随逗号的对象文字和数组文字。
var obj = {
a: 1,
b: 2, // trailing comma is bad!
};
...... vs ...
var obj = {
a: 1,
b: 2 // no trailing comma!
};
修复方法是删除尾随的逗号。
答案 1 :(得分:2)
您有三种方法可以摆脱此警告: