Subject: | simple parse error, breaks jQuery beautification |
Date: | Tue, 9 Aug 2016 10:35:38 +1000 |
To: | bug-JavaScript-Beautifier [...] rt.cpan.org |
From: | pcna [...] zacglen.net |
There is a simple bug that arises when attempting to beautify, for
example, jQuery minimized script.
The Beautifier turns this:
/^(get|post|head|put|delete|options)$/ i.test(this.type) ...
into this:
/ ^(get | post | head | put | delete | options) $ / i.test(this.type) &&
It raises a JavaScript parse error.
Beautifier should not insert additional white-space inside of regular
expressions. They should be treated like quoted strings.
Possibly might be caused by the wider context which is:
return !this.isLocal &&
// several comment lines
/^(get|post|head|put|delete|options)$/ i.test(this.type)