--in-source-map Input source map, useful if you're compressing
JS that was generated from some other original
code.
- --screw-ie8 Pass this flag if you don't care about full
- compliance with Internet Explorer 6-8 quirks
- (by default UglifyJS will try to be IE-proof).
+ --screw-ie8 Use this flag if you don't wish to support
+ Internet Explorer 6-8 quirks.
+ By default UglifyJS will not try to be IE-proof.
+ --support-ie8 Use this flag to support Internet Explorer 6-8 quirks.
+ Note: may break standards compliant `catch` identifiers.
--expr Parse a single expression, rather than a
program (for parsing JSON)
-p, --prefix Skip prefix for original filenames that appear
var path = require("path");
var async = require("async");
var acorn;
+var screw_ie8 = true;
var ARGS = yargs
.usage("$0 input1.js [input2.js ...] [options]\n\
Use a single dash to read input from the standard input.\
.describe("source-map-url", "The path to the source map to be added in //# sourceMappingURL. Defaults to the value passed with --source-map.")
.describe("source-map-include-sources", "Pass this flag if you want to include the content of source files in the source map as sourcesContent property.")
.describe("in-source-map", "Input source map, useful if you're compressing JS that was generated from some other original code.")
- .describe("screw-ie8", "Pass this flag if you don't care about full compliance with Internet Explorer 6-8 quirks (by default UglifyJS will try to be IE-proof).")
+ .describe("screw-ie8", "Do not support Internet Explorer 6-8 quirks. This flag is enabled by default.")
+ .describe("support-ie8", "Support non-standard Internet Explorer 6-8 javascript. Note: may break standards compliant `catch` identifiers.")
.describe("expr", "Parse a single expression, rather than a program (for parsing JSON)")
.describe("p", "Skip prefix for original filenames that appear in source maps. \
For example -p 3 will drop 3 directories from file names and ensure they are relative paths. \
.string("p")
.string("prefix")
.string("name-cache")
+
.array("reserved-file")
.array("pure-funcs")
.boolean("expr")
.boolean("source-map-include-sources")
.boolean("screw-ie8")
+ .boolean("support-ie8")
.boolean("export-all")
.boolean("self")
.boolean("v")
COMPRESS.properties = false;
}
-if (ARGS.screw_ie8) {
- if (COMPRESS) COMPRESS.screw_ie8 = true;
- if (MANGLE) MANGLE.screw_ie8 = true;
- OUTPUT_OPTIONS.screw_ie8 = true;
+if (ARGS.support_ie8 === true && ARGS.screw_ie8 !== true) {
+ screw_ie8 = false;
}
+if (COMPRESS) COMPRESS.screw_ie8 = screw_ie8;
+if (MANGLE) MANGLE.screw_ie8 = screw_ie8;
+OUTPUT_OPTIONS.screw_ie8 = screw_ie8;
+
if (ARGS.keep_fnames) {
if (COMPRESS) COMPRESS.keep_fnames = true;
if (MANGLE) MANGLE.keep_fnames = true;
if (SCOPE_IS_NEEDED) {
time_it("scope", function(){
- TOPLEVEL.figure_out_scope({ screw_ie8: ARGS.screw_ie8, cache: TL_CACHE });
+ TOPLEVEL.figure_out_scope({ screw_ie8: screw_ie8, cache: TL_CACHE });
if (ARGS.lint) {
TOPLEVEL.scope_warnings();
}
if (SCOPE_IS_NEEDED) {
time_it("scope", function(){
- TOPLEVEL.figure_out_scope({ screw_ie8: ARGS.screw_ie8, cache: TL_CACHE });
+ TOPLEVEL.figure_out_scope({ screw_ie8: screw_ie8, cache: TL_CACHE });
if (MANGLE && !TL_CACHE) {
TOPLEVEL.compute_char_frequency(MANGLE);
}
comments : false,
shebang : true,
preserve_line : false,
- screw_ie8 : false,
+ screw_ie8 : true,
preamble : null,
quote_style : 0,
keep_quoted_props: false
// adds the block brackets if needed.
if (!self.body)
return output.force_semicolon();
- if (self.body instanceof AST_Do
- && !output.option("screw_ie8")) {
+ if (self.body instanceof AST_Do) {
+ // Unconditionally use the if/do-while workaround for all browsers.
// 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
options = {}
beautify = {
ascii_only : true,
+ screw_ie8 : true,
beautify : false,
}
input: {
"\x20\x21\x22\x23 ... \x7d\x7e\x7f\x80\x81 ... \xfe\xff\u0fff\uffff";
}
}
- expect_exact: 'function f(){return"\\x000\\x001\\x007\\08\\0"+"\\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\b\\t\\n\\x0B\\f\\r\\x0e\\x0f"+"\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f"+\' !"# ... }~\\x7f\\x80\\x81 ... \\xfe\\xff\\u0fff\\uffff\'}'
+ expect_exact: 'function f(){return"\\x000\\x001\\x007\\08\\0"+"\\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\b\\t\\n\\v\\f\\r\\x0e\\x0f"+"\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f"+\' !"# ... }~\\x7f\\x80\\x81 ... \\xfe\\xff\\u0fff\\uffff\'}'
}
ascii_only_false: {
options = {}
beautify = {
ascii_only : false,
+ screw_ie8 : true,
beautify : false,
}
input: {
"\x20\x21\x22\x23 ... \x7d\x7e\x7f\x80\x81 ... \xfe\xff\u0fff\uffff";
}
}
- expect_exact: 'function f(){return"\\x000\\x001\\x007\\08\\0"+"\\0\x01\x02\x03\x04\x05\x06\x07\\b\\t\\n\\x0B\\f\\r\x0e\x0f"+"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"+\' !"# ... }~\x7f\x80\x81 ... \xfe\xff\u0fff\uffff\'}'
+ expect_exact: 'function f(){return"\\x000\\x001\\x007\\08\\0"+"\\0\x01\x02\x03\x04\x05\x06\x07\\b\\t\\n\\v\\f\\r\x0e\x0f"+"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"+\' !"# ... }~\x7f\x80\x81 ... \xfe\xff\u0fff\uffff\'}'
}