Skip to content

Ajax.Request broken in minified 1.7.2 #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
g-schanner opened this issue Mar 29, 2016 · 1 comment
Closed

Ajax.Request broken in minified 1.7.2 #312

g-schanner opened this issue Mar 29, 2016 · 1 comment

Comments

@g-schanner
Copy link

It seems that a regular Ajax.Request call breaks in the minified version of the library.
See not minified:
https://jsfiddle.net/4db2rbdy/1/
versus minified:
https://jsfiddle.net/wp1zupwa/1/

I also tested several online minifying websits (such as https://javascript-minifier.com/ and http://refresh-sf.com/) but to no avail.

However, the Google Closure compiler seems to work fine https://closure-compiler.appspot.com/home.

Tested it with Firefox 45.0.1 and Chrome 39.0.2171.95 (64-bit)

(Probably somehow related to cdnjs/cdnjs#2872)

@jwestbrook
Copy link
Collaborator

The Class construct that builds out Prototype's pseudo OOP structure examines the name of the first parameter in each class method, in your example the initialize method. If the parameter name is $super then that variable is set to the parent/super class instance's method of the same name. In the examples you gave the parameter is renamed to e instead. Google's Closure Compiler on SIMPLE compression does not rename that parameter (I use Google's minified version on my production site).

I think if the $super variable can be protected from being renamed then the minification would work successfully.

I wrote a StackOverflow answer that has a simple Class definition that illustrates the inheritance and the use of $super http://stackoverflow.com/a/15527223/341491

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants