FileDrop
FileDrop copied to clipboard
YUI Compressor: Doesn't like IE Detection (cc_on)
I'm having problems compressing filedrop.js
using YUI Compressor:
[I]> java -jar yuicompressor-2.4.8.jar --type js --charset utf-8 filedrop.js
[ERROR] in filedrop.js
568:66:missing } after property list
[ERROR] in filedrop.js
569:11:syntax error
[ERROR] in filedrop.js
573:14:syntax error
[ERROR] in filedrop.js
577:12:syntax error
[ERROR] in filedrop.js
578:4:syntax error
[ERROR] in filedrop.js
603:10:syntax error
[ERROR] in filedrop.js
1385:9:missing ) after argument list
[ERROR] in filedrop.js
1385:10:syntax error
[ERROR] in filedrop.js
1579:3:syntax error
[ERROR] in filedrop.js
1590:10:syntax error
[ERROR] in filedrop.js
1831:3:syntax error
[ERROR] in filedrop.js
1834:10:syntax error
[ERROR] in filedrop.js
1835:10:syntax error
[ERROR] in filedrop.js
1849:10:syntax error
[ERROR] in filedrop.js
2375:3:syntax error
[ERROR] in filedrop.js
2385:10:syntax error
[ERROR] in filedrop.js
2389:11:invalid return
[ERROR] in filedrop.js
2390:3:syntax error
[ERROR] in filedrop.js
2466:10:syntax error
[ERROR] in filedrop.js
2467:8:syntax error
[ERROR] in filedrop.js
2468:13:missing ; before statement
[ERROR] in filedrop.js
2470:7:syntax error
[ERROR] in filedrop.js
2471:44:missing ; before statement
[ERROR] in filedrop.js
2476:7:syntax error
[ERROR] in filedrop.js
2489:19:invalid return
[ERROR] in filedrop.js
2491:19:invalid return
[ERROR] in filedrop.js
2506:17:invalid return
[ERROR] in filedrop.js
2515:13:invalid return
[ERROR] in filedrop.js
2516:5:syntax error
[ERROR] in filedrop.js
2521:1:syntax error
[ERROR] in filedrop.js
1:0:Compilation produced 30 syntax errors.
org.mozilla.javascript.EvaluatorException: Compilation produced 30 syntax errors.
at com.yahoo.platform.yui.compressor.YUICompressor$1.runtimeError(YUICompressor.java:172)
at org.mozilla.javascript.Parser.parse(Parser.java:396)
at org.mozilla.javascript.Parser.parse(Parser.java:340)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:315)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:536)
at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:147)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
It fails on these lines:
isIE6: /*@cc_on/*@if(@_jscript_version<=5.7)true@else@*/false/*@end@*/,
isIE9: /*@cc_on/*@if(@_jscript_version<=9)true@else@*/false/*@end@*/,
I commented on an existing YUI Compressor issue but I don't expect them to do anything about it soon: https://github.com/yui/yuicompressor/issues/119#issuecomment-146721040
Is there any workaround for this? Perhaps another method of IE detection?
My workaround was just to use UserAgent sniffing rather than conditional compilation which can be found at iFixit/FileDrop#1. Feel free to cherry-pick the commit in this repo if you'd like.