Fixed dot property issue with invlid identifier names.
authorJustin Lau <justin@tclau.com>
Sun, 5 May 2013 14:27:43 +0000 (22:27 +0800)
committerJustin Lau <justin@tclau.com>
Sun, 5 May 2013 14:27:43 +0000 (22:27 +0800)
Signed-off-by: Justin Lau <justin@tclau.com>
lib/compress.js

index ebd3dd7..623fe45 100644 (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