how to fix closure compiler error on css({ float: 'left' }) [duplicate]
Asked Answered
G

1

0

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

I tried to use closure compiler from

http://closure-compiler.appspot.com/home

to compile code

// ==ClosureCompiler==
// @output_file_name default.js
// @compilation_level ADVANCED_OPTIMIZATIONS
// ==/ClosureCompiler==

css({ float: 'left' })

but got error

JSC_PARSE_ERROR: Parse error. invalid property id at line 1 character 6
css({ float: 'left' })

How to fix it? This code is used in Oleg jqGrid createContexMenuFromNavigatorButtons method posted in stackoverflow answer.

Giorgio answered 23/9, 2012 at 14:32 Comment(2)
Possible duplicate: Google Closure Compiler parse error: invalid property id for css({float:'left'})Poinciana
Closure Compiler FAQ: I get "invalid property id" errors. But it works on Firefox!Staid
N
3

float is likely to be recognized as a reserved word (although it isn't, it was in ES3), so it should be safe to use

css({ "float": "left"})
Nogood answered 23/9, 2012 at 14:34 Comment(2)
It is a reserved word in EcmaScript 3 which is the standard version of JavaScript supported by IE8 and below. As stated in the Closure Compiler FAQ, you can avoid this warning by specifically stating you are targeting EcmaScript 5 (Internet Explorer 9 era and newer browsers)Staid
@John: thanks for the hint! I added a link to the reference :-)Nogood

© 2022 - 2024 — McMap. All rights reserved.