https://bugzilla.wikimedia.org/show_bug.cgi?id=27528

--- Comment #6 from Roan Kattouw <roan.katt...@gmail.com> 2011-02-19 12:32:32 
UTC ---
(In reply to comment #5)
> Reopening per my comment above. As pointed out, it's not possible to minify js
> with simple regexes without breaking user code in some cases.
> 
> FTR here are two sample test cases that currently break:
> 
> > echo JavascriptDistiller::stripWhiteSpace("alert( (10+10) / '/'.charCodeAt( 
> > 0 ) ) + '//' );\n");
> alert((10+10)/ '/'.charCodeAt( 0 ) ) + '
> 
This has unbalanced parentheses, but the issue you point our (division
interpreted as start of regex, string vs. not string swapped for the rest of
the input) is valid.

> > echo JavascriptDistiller::stripWhiteSpace("if(1)/a /g.exec('Pa ss');");
> if(1)/a/g.exec('Pa ss');
This one is so devious that even Douglas Crockford's JSMin falls for it :O

(In reply to comment #3)
> So to do minifying without breaking correct javascript, you'll need to do 
> basic
> stack parsing on the javascript. I've written sth. similar in C a while ago, 
> so
> if someone is willing to review or use it, I can try to port it to php and 
> post
> it here.
I'm interested. I'm also willing to port it to PHP myself if you give me the C
code and release it under a free license.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to