Google Closure Compiler parse error: invalid property id for `css({float:'left'})`

前端 未结 2 1736
我寻月下人不归
我寻月下人不归 2021-01-19 03:29

I\'m using Google Closure Compiler application (command line interface). When I run it I get the below error.

deploy/js/Home.js:40: ERROR - Parse error. inva         


        
2条回答
  •  终归单人心
    2021-01-19 04:11

    I believe that you need to do:

    {'float':'left'}
    

    This is because float is on the list of Java keywords reserved by JavaScript, so it cannot be used as a property name. This may no longer be an issue in newer JS engines, but it can be a problem in older ones, which is why the Compiler yields an error.

提交回复
热议问题