tikitu / jsmin

Javascript minifier
MIT License
90 stars 17 forks source link

re delimiters // and if make broken js. #12

Closed kilgoretrout1985 closed 8 years ago

kilgoretrout1985 commented 8 years ago

This code from Django 1.8.5 admin (yes, no semicolon, but still valid js if I'm not mistaken).

var re = /\d{4}/
if (re.test(year.toString()) && month >= 1 && month <= 12) {
    DateTimeShortcuts.calendars[num].drawDate(month, year, selected);
}

becomes

var re=/\d{4}/if(re.test(year.toString())&&month>=1&&month<=12) ...

And it ends up with Firefox error - SyntaxError: invalid regular expression flag f.

Tried jsmin==2.1.5

tikitu commented 8 years ago

Thanks for the report; I'm preparing a release which differs by just one single character, which fixes this issue.

Also: nice nick.