Skip to content
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

Handle the case when js code returns a regexp from a function #11

Merged
merged 1 commit into from Feb 3, 2021

Conversation

faf
Copy link
Contributor

@faf faf commented Feb 2, 2021

In short, it fixes #10 .

That particular problem was caused by lack of handling the special case when a function contained return statement followed by a regular expression. The code treated initial slash of regexp as division operator, so the quote inside the regexp was treated as the beginning of a string, and so on, and so forth.

For example, an attempt to minify the code below caused unterminated single quoted string literal error.

var b=function(a){return /(\")/.test(a)}; console.log(b('"'));

Now it works. And it seems like minification of CKEditor mentioned in znuny/Znuny#6 goes well too (though, that should be double checked).

@faf
Copy link
Contributor Author

faf commented Feb 2, 2021

BTW, seems like it also fixes #2 . At least, the code mentioned in that issue now could be minified without errors (though, IDK whether it's working after minification).

@zoffixznet
Copy link
Owner

Thank you very much. Version 1.15 with this fix pushed to CPAN.

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

Successfully merging this pull request may close these issues.

Minification is corrupting the code
2 participants