LeaVerou / awesomplete

Ultra lightweight, usable, beautiful autocomplete with zero dependencies.
http://leaverou.github.io/awesomplete/
MIT License
6.96k stars 611 forks source link

The word "goto" breaks YUI Compressor #16862

Open sronnlund opened 8 years ago

sronnlund commented 8 years ago

FYI: YUI Compressor (2.4.8 - including, but not limited to) breaks when using reserved words as property names. The word goto is a "future reserved keywords in older standards", and is therefore not allowed by YUI Compressor. Be on the safe side and avoid using reserved (or previously reserved) words.

Thanks for making this awesom´ library!

Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar

LeaVerou commented 8 years ago

Unfortunately, this is part of the public API and cannot be changed at this point. Also, people still use YUI Compressor?!

sronnlund commented 8 years ago

I think a workaround could be to use bracket notation instead of dot notation for the goto property. And you're right, "people" don't really use YUI Compressor nowadays. However, it's sometimes bundled with enterprise CMSs, for instance. My current client uses Adobe Experience Manager, which (unfortunately) uses YUI Compressor under the hood.

sronnlund commented 8 years ago

Haha, YUI Compressor seems to have some serious issues with getters and setters...

/* Source */
var foo = {
    get bar() {
        return 'foobar';
    }
}

/* YUI Compressor output */
var foo={get barfunction(){return"foobar"}};

Yes. It renames bar to barfunction. Why it does this is beyond me. My brain hurts and my eyes are bleeding... :(

sronnlund commented 8 years ago

Seems issue with getters and setters was fixed in the latest version of YUI Compressor (2.4.8).

LeaVerou commented 8 years ago

LOL, wow. Why not use UglifyJS which is way more updated and doesn't have such issues?

sronnlund commented 8 years ago

Don't shoot the messenger! Tell that to Adobe... It's really a pain when an enterprise CMS bundles and enforces tools and libraries that can't be easily replaced. AEM also bundles (and depends on) a pretty outdated version of jQuery, which can also be quite troublesome. I don't know what they are thinking, since web technologies evolve much faster than their CMS.

LeaVerou commented 8 years ago

That sucks. I feel ya. :(