workaround Safari quirks (#5033)

closes #5032
This commit is contained in:
Alex Lam S.L
2021-06-24 10:09:19 +01:00
committed by GitHub
parent 7cbcd11440
commit 82772ccb12
4 changed files with 151 additions and 1 deletions

View File

@@ -108,6 +108,7 @@ function Compressor(options, false_by_default) {
unsafe_undefined: false,
unused : !false_by_default,
varify : !false_by_default,
webkit : false,
yields : !false_by_default,
}, true);
var evaluate = this.options["evaluate"];
@@ -5857,6 +5858,7 @@ merge(Compressor.prototype, {
if (head_refs.start.block !== tail_refs.start.block
|| !mergeable(head_refs, tail_refs)
|| (head_refs.start.loop || !same_scope(def)) && !mergeable(tail_refs, head_refs)
|| compressor.option("webkit") && is_funarg(def) !== is_funarg(tail.definition)
|| !all(tail_refs, function(sym) {
return sym.scope.find_variable(def.name) === def;
})) {

View File

@@ -100,7 +100,7 @@ function minify(files, options) {
if (options.keep_fnames) set_shorthand("keep_fnames", options, [ "compress", "mangle" ]);
if (options.toplevel) set_shorthand("toplevel", options, [ "compress", "mangle" ]);
if (options.v8) set_shorthand("v8", options, [ "mangle", "output" ]);
if (options.webkit) set_shorthand("webkit", options, [ "mangle", "output" ]);
if (options.webkit) set_shorthand("webkit", options, [ "compress", "mangle", "output" ]);
var quoted_props;
if (options.mangle) {
options.mangle = defaults(options.mangle, {