aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Bazon <mihai.bazon@gmail.com>2013-08-19 00:21:08 -0700
committerMihai Bazon <mihai.bazon@gmail.com>2013-08-19 00:21:08 -0700
commit4f09df238e15bfb9d03d28ba718c402bad0b1078 (patch)
tree3c5ed5c5669f36b6d77a3402af9946f8ce55d342
parent6ea3f7fe34e73f7f64b1a52c6dd0a3dcd9faa72e (diff)
parentd9ad3c7cbf92c9b08d4f8eb4ec697a00d96c700a (diff)
downloadtracifyjs-4f09df238e15bfb9d03d28ba718c402bad0b1078.tar.gz
tracifyjs-4f09df238e15bfb9d03d28ba718c402bad0b1078.zip
Merge pull request #270 from michaelficarra/GH-259
fixes #259: don't unnecessarily quote object properties when --screw-ie8
-rwxr-xr-xbin/uglifyjs11
-rw-r--r--lib/compress.js3
-rw-r--r--lib/output.js10
3 files changed, 12 insertions, 12 deletions
diff --git a/bin/uglifyjs b/bin/uglifyjs
index cad29ee0..7a4f6224 100755
--- a/bin/uglifyjs
+++ b/bin/uglifyjs
@@ -129,11 +129,6 @@ if (ARGS.d) {
if (COMPRESS) COMPRESS.global_defs = getOptions("d");
}
-if (ARGS.screw_ie8) {
- if (COMPRESS) COMPRESS.screw_ie8 = true;
- if (MANGLE) MANGLE.screw_ie8 = true;
-}
-
if (ARGS.r) {
if (MANGLE) MANGLE.except = ARGS.r.replace(/^\s+|\s+$/g).split(/\s*,+\s*/);
}
@@ -142,6 +137,12 @@ var OUTPUT_OPTIONS = {
beautify: BEAUTIFY ? true : false
};
+if (ARGS.screw_ie8) {
+ if (COMPRESS) COMPRESS.screw_ie8 = true;
+ if (MANGLE) MANGLE.screw_ie8 = true;
+ OUTPUT_OPTIONS.screw_ie8 = true;
+}
+
if (BEAUTIFY)
UglifyJS.merge(OUTPUT_OPTIONS, BEAUTIFY);
diff --git a/lib/compress.js b/lib/compress.js
index 3bf9f672..8dfbc72b 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -2005,8 +2005,7 @@ merge(Compressor.prototype, {
var prop = self.property;
if (prop instanceof AST_String && compressor.option("properties")) {
prop = prop.getValue();
- if ((compressor.option("screw_ie8") && RESERVED_WORDS(prop))
- || (!(RESERVED_WORDS(prop)) && is_identifier_string(prop))) {
+ if (RESERVED_WORDS(prop) ? compressor.option("screw_ie8") : is_identifier_string(prop)) {
return make_node(AST_Dot, self, {
expression : self.expression,
property : prop
diff --git a/lib/output.js b/lib/output.js
index 90589a2d..6d0dac5a 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -54,13 +54,13 @@ function OutputStream(options) {
inline_script : false,
width : 80,
max_line_len : 32000,
- ie_proof : true,
beautify : false,
source_map : null,
bracketize : false,
semicolons : true,
comments : false,
preserve_line : false,
+ screw_ie8 : false,
negate_iife : !(options && options.beautify),
}, true);
@@ -761,7 +761,7 @@ function OutputStream(options) {
if (!self.body)
return output.force_semicolon();
if (self.body instanceof AST_Do
- && output.option("ie_proof")) {
+ && !output.option("screw_ie8")) {
// https://github.com/mishoo/UglifyJS/issues/#issue/57 IE
// croaks with "syntax error" on code like this: if (foo)
// do ... while(cond); else ... we need block brackets
@@ -1048,10 +1048,10 @@ function OutputStream(options) {
&& +key + "" == key)
&& parseFloat(key) >= 0) {
output.print(make_num(key));
- } else if (!is_identifier(key)) {
- output.print_string(key);
- } else {
+ } else if (RESERVED_WORDS(key) ? output.option("screw_ie8") : is_identifier_string(key)) {
output.print_name(key);
+ } else {
+ output.print_string(key);
}
output.colon();
self.value.print(output);