Fixed dot property issue with invlid identifier names.

Signed-off-by: Justin Lau <justin@tclau.com>
This commit is contained in:
Justin Lau
2013-05-05 22:27:43 +08:00
parent 8227e8795b
commit 1e3bc0caa0

View File

@@ -1962,7 +1962,8 @@ merge(Compressor.prototype, {
var prop = self.property;
if (prop instanceof AST_String && compressor.option("properties")) {
prop = prop.getValue();
if (is_identifier(prop) || compressor.option("screw_ie8")) {
if (is_identifier(prop)
|| (compressor.option("screw_ie8") && /^[a-z_$][a-z0-9_$]*$/i.test(prop))) {
return make_node(AST_Dot, self, {
expression : self.expression,
property : prop