Using latest (v1.20.2) and "Uglify.Js(text).Code" it appears that nested functions confuse the minifiers naming algorithm.
Possibly linked to #324.
Take the following example (code reduced for brevity, the methods and variable values are not important for this example, just the original name vs the minified one);
{
const n = document.getElementById("divMainPage");
function t(n) {
const t = n.transaction("txName", "readwrite"),
i = t.getDataObject(),
r = i.doSomething();
r.onsuccess = function(n) {
const t = n.target.result,
i = n.target.result,
r = n.target.result
}
}
}
We can see from the above result that n (variable1 un-minified) is declared first, then the first function variable is also declared n (db un-minified), hiding the outer n (variable1 un-minified) from the functions scope.
Minified r also has a similar issue, where it is declared, then a nested function follows and r is declared again.
For context, the actual code is much more complicated and chrome has no issues, but safari is not happy;
"ReferenceError: Can't find variable: r"
Using latest (v1.20.2) and "Uglify.Js(text).Code" it appears that nested functions confuse the minifiers naming algorithm. Possibly linked to #324.
Take the following example (code reduced for brevity, the methods and variable values are not important for this example, just the original name vs the minified one);
Minified this becomes;
We can see from the above result that n (variable1 un-minified) is declared first, then the first function variable is also declared n (db un-minified), hiding the outer n (variable1 un-minified) from the functions scope.
Minified r also has a similar issue, where it is declared, then a nested function follows and r is declared again.
For context, the actual code is much more complicated and chrome has no issues, but safari is not happy; "ReferenceError: Can't find variable: r"
Thanks