-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
typeof changed even when "unsafe" is false #2198
Comments
There is no such CLI option as If I understand you correctly, are you implying > var e = {};
> Object.defineProperty(e, "prop", {get:function(){console.log("called")}});
> e.prop;
undefined
called
> typeof e.prop
"undefined"
called
> typeof e.prop === "undefined"
true
called
> e.prop === void 0
true
called Possibly related to #1446 |
Already edited. See above. This is not related to property getters, only native methods like |
We adopted the |
Actually, I was able to reproduce with a short test using XML: http://jsbin.com/hokafa Open in IE9 or IE10. You'll see "Wrong number of arguments" in the console. |
I don't run Windows so I am unable to verify this. I'm having difficulty understanding these statements:
Does the If the
|
@kzc @alexlamsl I know the workaround. I gave an example of the workaround. The bug is simply that the |
It would be ideal for me if the transformation was dependent on |
I just re-read @kzc's comment. I didn't realize this was included in comparisons. That does seem odd as well. |
Despite the incorrect "unsafe" documentation, the It would be unfortunate if this |
That's fair. Although, it also seems unfortunate that jQuery has to be compressed with ie8 set to true when it doesn't actually support ie8. |
The upside is that even with ie8 set to true, our recent upgrade of uglify still reduced the size by 16 gzipped bytes. So, all in all, I think Uglify is doing an excellent job. Thanks. |
|
Yeah, and I also get My theory is that IE9/10 treats TIL: > elem.getAttribute()
Wrong number of arguments or invalid property assignment > elem.getAttribute(0)
This name may not begin with the '0' character:
-->0<-- > elem.getAttribute(true)
This name may not begin with the '-' character:
-->-<--1 > elem.getAttribute(null)
Type mismatch > elem.getAttribute("foo")
null |
@alexlamsl In light of these findings, what's the best course of action?
|
I think (3) is probably the best way to go - I was thinking of introducing |
(3) is fine, but I'd suggest naming it after what it does - Would also have to update the |
Thank you - I really wasn't thrilled about
👍 |
Thank you @kzc and @alexlamsl! You two rock. |
- Uses new typeofs option for compression - See mishoo/UglifyJS#2198 Close jquerygh-3710
- Uses new typeofs option for compression - See mishoo/UglifyJS#2198 Close gh-3710
We ran into an issue when compressing jQuery with the latest version (3.0.23). The README implies that the
typeof
should remain unchanged whenunsafe
is set tofalse
. Nevertheless, only when settingie8
totrue
did we get the expected output.Sometimes, methods are invoked in IE9/IE10 when simply referencing them as properties. In this case,
.getAttribute
is called despite the lack of parens, throwing an error. Only whentypeof
remains untouched is the error avoided. Reduced example is below.Bug report
ES5
Uglify version (
uglifyjs -V
)uglify-js 3.0.23
JavaScript input
The
uglifyjs
CLI command executed orminify()
options used.or
JavaScript output or error produced.
Correct output is produced with
Output being:
Problem is, the output is unsafe for IE9/IE10 as well.
The text was updated successfully, but these errors were encountered: