[英]Javascript Closure Compiler Error Trailing Comma?
當谷歌通過名為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, //
錯誤(因為害怕簡單地重寫Closure Compiler錯誤所說的內容)是IE8及以下版本無法解析具有尾隨逗號的對象文字和數組文字。
var obj = {
a: 1,
b: 2, // trailing comma is bad!
};
......對......
var obj = {
a: 1,
b: 2 // no trailing comma!
};
修復是刪除尾隨逗號。
您有三種方法可以擺脫此警告:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.