Age | Commit message (Collapse) | Author |
|
Previously:
Without `--screw-ie`, UglifyJS would always leak names of function
expressions into the containing scope, as if they were function
declarations. That was to emulate IE<9 behavior. Code relying on this
IE bug would continue to work properly after mangling, although it would
only work in IE (since other engines don't share the bug). Sometimes
this broke legitimage code (see #153 and #155).
With `--screw-ie` the names would not be leaked into the current scope,
working properly in legit cases; but still it broke legit code when
running in IE<9 (see #24).
Currently:
Regardless of the `--screw-ie` setting, the names will not be leaked.
Code relying on the IE bug will not work properly after mangling.
<evil laughter here>
Without `--screw-ie`: a hack has been added to the mangler to avoid
using the same name for a function expression and some other variable in
the same scope. This keeps legit code working, at the (negligible,
indeed) cost of one more identifier.
With `--screw-ie` you allow the mangler to name function expressions
with the same identifier as another variable in scope. After mangling
code might break in IE<9.
Oh man, the commit message is longer than the patch.
Fix #153, #155
|
|
Close #127
|
|
Close #147
|
|
Close #143
|
|
For now the implication is that UglifyJS will not leak a function
expression's name in the surrounding scope (IE < 9 does that).
(ref. mishoo/UglifyJS#485)
|
|
Close #141
|
|
Close #137
|
|
It's not safe to transform it to {...} because the body might contain
`break`. The solution could be more elaborate (detect if body contains
`break`) but I don't think it's worth the trouble.
Close #129
|
|
Close #118
|
|
Close #117
------
JS, WHY YOU SUCK SO BADLY? ;-(
|
|
Close #116
|
|
Close #115
|
|
Close #114
|
|
Close #113
|
|
Close #112
|
|
|
|
|
|
|
|
1b6bcca7 was a first attempt at this. That commit made Uglify stop replacing
holes with undefined, but instead it started replacing undefined with
holes. This is slightly problematic, because there is a difference between a
hole and an undefined value. More problematically, it changed [1,undefined] to
[1,] which generally doesn't even parse as a hole (just as a trailing comma), so
it didn't even preserve the length of the array!
Instead, parse holes as their own special AST node which prints invisibly.
|
|
Fix #91
|
|
|
|
close #83
|
|
[not sure I'm happy about this fix]
Reference mishoo/UglifyJS#478
|
|
Close #74
|
|
(need to force a semicolon for the empty body of an `if`)
Close #72
|
|
|
|
fix #60.
|
|
|
|
|
|
Fix #59
|
|
|
|
|
|
|
|
otherwise we change the meaning of eval from global to lexical.
|
|
Usage: uglifyjs2 -b "beautify=0,preserve_line=1" /path/to/js
ref #46
|
|
|
|
ref. mishoo/UglifyJS#441
|
|
into rvanvelzen-optimize_concat
|
|
|
|
ref. #43
|
|
close #44
|
|
In some places this can save one byte in whitespace, e.g. after return.
Example:
function f(arg) {
// return""+arg - no space between return and ""
return arg.toString();
}
|
|
|
|
close #36, #38
|
|
for(...; x; ...) if (y) break; → for(...; x&&!y; ...);
similarly for `while` and some combinations (i.e. the `break` appears in the
`else` clause, etc.)
|
|
we do need parens here: `new (foo.bar().baz)`, but not here: `new foo.bar.baz`
|
|
|
|
AST_Accessor will represent the function for a setter or getter. Since they
are not mangleable, and they should not introduce a name in scope, we have a
new node for their name (AST_SymbolAccessor) which doesn't inherit from
AST_SymbolDeclaration.
fix #37
|
|
refs #35
|
|
|