Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 59355
Status: resolved
Priority: 0/
Queue: JavaScript-Minifier

People
Owner: cpan [...] zoffix.com
Requestors: kev [...] brantaero.com
mg.pub [...] gmx.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.05
Fixed in: (no value)



Subject: "unterminated regular expression literal" when using CDATA without slash afterwards
On perl5.10/win32: This was a bit tough to track down, but if I load and try to minimize a file containing these lines: ""+<r><![CDATA[ ]]></r>; ...then I get the following error: unterminated regular expression literal, stopped at JavaScript/Minifier.pm line 151. However, if I add any line to the file involving a slash, it works: ""+<r><![CDATA[ ]]></r>; 2/2; ...gets me no error. Also, stripDebug makes no difference, it still breaks without the slash, and is fine when it's there. This isn't actually critical for me, because I had been using this CDATA setup to embed CSS in my JS files, which I'll now be separating out again so that I can minify the CSS as well. But since I encountered it, and this is valid JavaScript, I thought I should report it.
Subject: unterminated regular expression literal on a very simple valid regular expression
While trying to minify the jQuery TableSorter plugin (http://tablesorter.com/docs/), JavaScript::Minifier 1.05 crashed with the error message given in the subject of this report. The smallest piece of sourcecode causing the crash is: function test(s) { return /\d{1,2}/.test(s); } A workaround would be function test(s) { return (/\d{1,2}/).test(s); } But since our software should allow for customization and also external JavaScript code which is beyond our control, it would be GREAT if you could consider fixing this bug report. Maybe you want to minify the entire tablesorter plugin file which I attached after the bug is fixed. This has more complicated regular expressions inside, like this one: ... is: function(s) { return /\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s); }, ... Thanks for considering, I would be very happy about a solution in the near future. Best regards, mg
Subject: jquery.tablesorter.js
Download jquery.tablesorter.js
application/x-javascript 22.8k

Message body not shown because it is not plain text.

Going to stall this for now. The issue is this: the way the original author wrote the code makes the module think the opening '/' on the regex is actually a division, because the previous word "return" ends on an alphanumeric character ( basically, it thinks the regex is the beginning of " n / SOMETHING". I need to read up more on how JS parsers figure this one out, and then think up a fix :) Thanks for reporting (yeah, I know it's been years hehe :)) -- Cheers, ZZ [ https://metacpan.org/author/ZOFFIX ]
Moving this to the preferred bug tracker on Git Hub, so it doesn't get lost: https://github.com/zoffixznet/JavaScript-Minifier/issues/2 -- Cheers, ZZ [ https://metacpan.org/author/ZOFFIX ]