Skip Menu |

This queue is for tickets about the JavaScript-Minifier-XS CPAN distribution.

Report information
The Basics
Id: 80598
Status: rejected
Priority: 0/
Queue: JavaScript-Minifier-XS

People
Owner: Nobody in particular
Requestors: delvarworld [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.09
Fixed in: (no value)



use JavaScript::Minifier::XS qw(minify); $minified = minify(" function a() { return ( /\// ).test( url ); }"); say $minified; Output: function a(){return(}; There is similar code in the jquery mobile js (the isPath function uses that regex syntax) and the XS minifier completely hoses it. It's not only different than the original but the syntax is also invalid. I'm guessing it thinks \// is the start of a comment even though it's a valid regex. A workaround for this specific syntax is to use return new RexExp('/').test( url ); but at least in this case the source is an external dep, so it's not safe to go modifying it
On Sat Nov 03 04:13:03 2012, delvarworld wrote: Show quoted text
> use JavaScript::Minifier::XS qw(minify); > $minified = minify(" > function a() { > return ( /\// ).test( url ); > }"); > say $minified;
In the code you provided above, you've double-quoted the string, so that "/\//" is just escaping out the "/" character and by the time JS:M:XS gets it, it looks like "///". I have, however, added a test using that JS to ensure that JS:M:XS handles this properly (which it seems to).