aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2014-08-26 10:11:01 +0300
committerMihai Bazon <mihai@bazon.net>2014-08-26 10:11:01 +0300
commit4c64554808e0805b86893704dc87df9ec449961a (patch)
tree84de67ba734294df2111ca7b0d9ccc2cbb682c67 /lib/compress.js
parent548beeb6b1fee91404a0c41bf9661604995cc59c (diff)
downloadtracifyjs-4c64554808e0805b86893704dc87df9ec449961a.tar.gz
tracifyjs-4c64554808e0805b86893704dc87df9ec449961a.zip
Turn foo.new into foo["new"] when not --screw-ie8. Fix #534
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 1e99f158..b55361b3 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -2371,6 +2371,15 @@ merge(Compressor.prototype, {
});
OPT(AST_Dot, function(self, compressor){
+ var prop = self.property;
+ if (RESERVED_WORDS(prop) && !compressor.option("screw_ie8")) {
+ return make_node(AST_Sub, self, {
+ expression : self.expression,
+ property : make_node(AST_String, self, {
+ value: prop
+ })
+ }).optimize(compressor);
+ }
return self.evaluate(compressor)[0];
});