我使用html5boilerplate構建腳本和涅槃的腳本(使用谷歌關閉編譯)IE瀏覽器,使用Closure Compiler和尾隨逗號
當我得到這個錯誤
-js.all.minify:
[echo] Minifying scripts
[copy] Copying 3 files to /Users/Username/Desktop/Web/intermediate/js
[apply] /Users/Juan/Desktop/Web/js/plugins.js:117: ERROR - Parse error. Internet Explorer has a non-standard intepretation of trailing commas. Arrays will have the wrong length and objects will not parse at all.
[apply] }, { duration: 727 })
[apply]
^
但代碼如果運行未編譯,是否可以在IE 8中運行。
這是代碼
anim1.animate({
'left': '+=32px',
'filter': 'alpha(opacity=100)',
'-moz-opacity': '1',
'-khtml-opacity': '1',
'opacity': '1',
}, { duration: 727 })
我怎樣才能使此代碼通Compulsure編譯器?
感謝
我在這段代碼上花費太多,我無法看到它在我的眼中。我仍然覺得IE 7,8,9中的代碼工作正常,但編譯器認爲它存在某種致命錯誤。謝謝Frédéric。 – Juan 2012-08-06 11:55:09
這是一篇解釋原因的文章:http://www.enterprisedojo.com/2010/12/19/beware-the-trailing-comma-of-death/。您可以使用'--jscomp_warning internetExplorerChecks'標誌將此錯誤轉換爲警告。 – 2012-08-06 15:43:21
如果JSHint和JSLint告訴我這件事真的很高興,因爲我整天都在浪費這個...... SMDH謝謝 – 2013-12-16 18:44:27