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
verify that property names after mangle are legal #1481
Conversation
…that it is not a reserved word. This should apply to propsmangle as well.
I don't think this PR is necessary. Can you demonstrate a case where |
This seems to be an issue only for older versions of ie. If you don't wish
to support them reject my pull request.
However, i think it would be proper to make sure in the Documentation that
you do not support those versions, so that projects that need them will not
rely on this package.
Thanks
בתאריך 10 בפבר 2017 16:45, "kzc" <notifications@github.com> כתב:
… I don't think this PR is necessary. Can you demonstrate a case where
***@***.*** produces invalid ES5.1 code?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1481 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABI4ZxBp_hdVqW-cPBLaNfvJzfguZvFvks5rbHf-gaJpZM4L9Ugr>
.
|
I still believe that there can be done more effort to spread the message (in real life, not by spammy and annoying deprecation notes) that older computers (windows 7 and especially older ones) should be replaced or in the rare case, upgraded. |
Well, good luck with that quest ☺
A note in the project's page "We believe that older versions of windows
should be replaced or ar least upgraded and therefore uglifyjs does not
support ie6/7 at all and sometimes creates code that breaks in ie 6/7" will
be a step in the right direction.
בתאריך 12 בפבר 2017 10:19, "Anthony Van de Gejuchte" <
notifications@github.com> כתב:
… I still believe that there can be done more effort to spread the message
(in real life, not by spammy and annoying deprecation notes) that older
computers (windows 7 and especially older ones) should be replaced or in
the rare case, upgraded.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1481 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABI4Z2nqdzP_u5zDgA3geCPgiUye6oIGks5rbsCegaJpZM4L9Ugr>
.
|
I don't understand what issue does this fix. Can you describe? |
Hi
In ie 6/7 property names such as "if" throw an error.
This fix would solve that.
However i was explained that you do not wish to support older versions of
ie. I do think though that some disclaimer that this is yhe case is in
order.
Thanks.
בתאריך 12 בפבר 2017 10:45, "Mihai Bazon" <notifications@github.com> כתב:
… I don't understand what issue does this fix. Can you describe?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1481 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABI4ZyWvJqU2V0aTdwrMePNy-VWMgUXNks5rbsa1gaJpZM4L9Ugr>
.
|
Got it. Merged, thanks. |
thank you very much!
בתאריך 12 בפבר 2017 11:00, "Mihai Bazon" <notifications@github.com> כתב:
… Got it. Merged, thanks.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1481 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABI4ZwjjUp462t4xP4YDG5m4hp7a_0tLks5rbsoTgaJpZM4L9Ugr>
.
|
(to avoid confusion, I just watched this from the phone and just attacked the statement involved old browsers, oh well) |
@mishoo This PR is not required as such functionality can be supported by existing uglify options. A property that happens to match a keyword is no different from any other property that a user may want to be excluded from Since properties matching keywords in IE8 have to be quoted anyway, reserving quoted properties in uglify-js@2.7.5:
Edit: My last post incorrectly used |
My issue was not about quoted properties...
It was about a regular pretty that was renamed to "if" by uglifyjs.
See attachment.
While this script is valid in chrome, in ie 6/7 it causes a syntax error.
Anyhow, I'm closing the pull request because it has unneeded code and pull
request #1481 that was merged solves the issue in a much more elegant way.
reproduceuglifybug.zip
<https://drive.google.com/file/d/0B9Zs5AKW3M8IQ1plTzJTaDV1cTFUVlNBV1czaVhNT0VMQVd3/view?usp=drive_web>
2017-02-12 18:21 GMT+02:00 kzc <notifications@github.com>:
… @mishoo <https://github.com/mishoo> This PR is not required for IE6/7/8.
Furthermore, it does not appear to work.
Consider:
***@***.***:
$ echo 'obj.fi = obj.if;' | uglifyjs -m -c --mangle-props --screw-ie8
obj.a=obj.b;
This PR:
$ echo 'obj.fi = obj.if;' | bin/uglifyjs -m -c --mangle-props --screw-ie8
obj.a=obj.if;
Notice that the preserved .if property is still invalid in IE8.
There is nothing special about the property "if" except that it must be
quoted in IE8.
But it *still* doesn't work with this PR using a quoted property:
Quoted if property using this PR:
$ echo 'obj.fi = obj["if"];' | bin/uglifyjs -m -c --mangle-props --screw-ie8
obj.a=obj.if;
It's still an invalid IE8 program.
This PR is not necessary. Preserving quoted properties in ***@***.***
can be achieved by using --mangle-props=unquoted:
***@***.***:
$ echo 'obj.fi = obj["if"];' | uglifyjs -m -c --mangle-props=unquoted --screw-ie8
obj.a=obj["if"];
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1481 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABI4Z6ZyklSqoyfe8SIz8Do3jRwz1cj2ks5rbzGjgaJpZM4L9Ugr>
.
|
This PR is still not required. Just use the A program to generate enough properties to make a property named "
with --screw-ie8:
with --support-ie8:
Notice that the mangled property names matching keywords are quoted if you use the |
Now i understand... i could use quote-keys in the output to quote all keys
and this would make the if property valid.
Thanks and sorry for your time.
בתאריך 12 בפבר 2017 22:14, "kzc" <notifications@github.com> כתב:
It was about a regular [property] that was renamed to "if" by uglifyjs.
This PR is still not required.
Just use the uglify-js@2.7.5 --support-ie8 flag in the CLI or screw_ie8:
false in minify():
A program to generate enough properties to make a property named "if" once
mangled by uglify:
$ cat gen.js
// generate enough properties to hit "if" once mangled...
console.log("o = {}");
for (var i = 0; i < 1000; ++i) {
console.log("o.p" + i + " = " + i + ";");
}
$ node gen.js
o = {}
o.p0 = 0;
o.p1 = 1;
o.p2 = 2;
...
o.p997 = 997;
o.p998 = 998;
o.p999 = 999;
$ uglifyjs -V
uglify-js 2.7.5
with *--screw-ie8*:
$ node gen.js | uglifyjs -m -c sequences=0 --mangle-props -b
--screw-ie8 | grep if
o.if = 331;
with *--support-ie8*:
$ node gen.js | uglifyjs -m -c sequences=0 --mangle-props -b
--support-ie8 | grep if
o["if"] = 331;
$ node gen.js | uglifyjs -m -c sequences=0 --mangle-props -b
--support-ie8 | grep '"'
o["if"] = 331;
o["in"] = 762;
o["do"] = 811;
Notice that the keywords are quoted if you use the --support-ie8 flag for
uglify-js@2.7.5
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1481 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABI4ZwH3wUW67aljZuMvWPmjhjU5THHqks5rb2gSgaJpZM4L9Ugr>
.
|
@mishoo In light of the fact that This PR negatively impacts minify size for non-IE platforms. |
Also handle `-Infinity` correctly. reverts mishoo#1481
- fix handling of "-Infinity" - add test case for "-0" reverts mishoo#1481
- fix handling of "-Infinity" - add test case for "-0" reverts mishoo#1481
- fix handling of "-Infinity" - add test case for "-0" reverts #1481
same as in mangle_names (for variables/functions)