Internet Explorer, Closure Compiler and Trailing Commas

前端 未结 2 653
陌清茗
陌清茗 2020-12-19 11:50

I\'m using html5boilerplate build script and when minifying the scripts (which uses Google Closure Compiler)

I\'m getting this error

-js.all.minify:         


        
2条回答
  •  甜味超标
    2020-12-19 12:26

    Remove the superfluous last comma from your object literal:

    anim1.animate({
        'left': '+=32px',
        'filter': 'alpha(opacity=100)',
        '-moz-opacity': '1',
        '-khtml-opacity': '1',
        'opacity': '1'      // <-- No comma here.
    }, { duration: 727 });  // <-- I'd also suggest a semicolon there.
    

    As the Closure compiler says, literals with such trailing commas cannot be parsed by some browsers.

提交回复
热议问题