{"action":"created","issue":{"url":"https://api.github.com/repos/mishoo/UglifyJS2/issues/1314","repository_url":"https://api.github.com/repos/mishoo/UglifyJS2","labels_url":"https://api.github.com/repos/mishoo/UglifyJS2/issues/1314/labels{/name}","comments_url":"https://api.github.com/repos/mishoo/UglifyJS2/issues/1314/comments","events_url":"https://api.github.com/repos/mishoo/UglifyJS2/issues/1314/events","html_url":"https://github.com/mishoo/UglifyJS2/issues/1314","id":180897134,"number":1314,"title":"mangle_properties globally ignores quoted properties","user":{"login":"AshleyScirra","id":768723,"avatar_url":"https://avatars.githubusercontent.com/u/768723?v=3","gravatar_id":"","url":"https://api.github.com/users/AshleyScirra","html_url":"https://github.com/AshleyScirra","followers_url":"https://api.github.com/users/AshleyScirra/followers","following_url":"https://api.github.com/users/AshleyScirra/following{/other_user}","gists_url":"https://api.github.com/users/AshleyScirra/gists{/gist_id}","starred_url":"https://api.github.com/users/AshleyScirra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AshleyScirra/subscriptions","organizations_url":"https://api.github.com/users/AshleyScirra/orgs","repos_url":"https://api.github.com/users/AshleyScirra/repos","events_url":"https://api.github.com/users/AshleyScirra/events{/privacy}","received_events_url":"https://api.github.com/users/AshleyScirra/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-10-04T13:44:15Z","updated_at":"2016-10-04T16:23:50Z","closed_at":null,"body":"Property mangling with `ignore_quoted: true` adds any quoted terms it finds to a global ignore list. For example:\r\n\r\n```\r\nfunction ReadJson(o)\r\n{\r\n\tthis.bar = o[\"foo\"];\r\n};\r\n\r\nfunction UnrelatedObject()\r\n{\r\n\tthis.foo = 1;\r\n};\r\n```\r\n\r\ncompiled with `--mangle-props=2 --beautify` returns\r\n\r\n```\r\nfunction ReadJson(o) {\r\n    this.a = o[\"foo\"];  // note 'bar' minified since not referenced anywhere\r\n}\r\n\r\nfunction UnrelatedObject() {\r\n    this.foo = 1; // note 'foo' not minified because referenced as quoted elsewhere\r\n}\r\n```\r\n\r\nThis has two disadvantages:\r\n\r\n- minification by property mangling is not effective as it could be, since it is unnecessarily avoiding minifying the property in unrelated objects when it would be safe to do so\r\n- minifying separate scripts will break some property accesses depending on if the term is used quoted elsewhere. For example if the above script is compiled, and then used together with a separately-compiled script accessing `unrelatedObject.foo`, that property access *will* be minified if \"foo\" is not used quoted anywhere in that file, and thus the property access is broken.\r\n\r\nTo solve this, mangle_properties() should not use a global ignore list, and should skip mangling quoted property accesses on a case-by-case basis."},"comment":{"url":"https://api.github.com/repos/mishoo/UglifyJS2/issues/comments/251438540","html_url":"https://github.com/mishoo/UglifyJS2/issues/1314#issuecomment-251438540","issue_url":"https://api.github.com/repos/mishoo/UglifyJS2/issues/1314","id":251438540,"user":{"login":"kzc","id":11593452,"avatar_url":"https://avatars.githubusercontent.com/u/11593452?v=3","gravatar_id":"","url":"https://api.github.com/users/kzc","html_url":"https://github.com/kzc","followers_url":"https://api.github.com/users/kzc/followers","following_url":"https://api.github.com/users/kzc/following{/other_user}","gists_url":"https://api.github.com/users/kzc/gists{/gist_id}","starred_url":"https://api.github.com/users/kzc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kzc/subscriptions","organizations_url":"https://api.github.com/users/kzc/orgs","repos_url":"https://api.github.com/users/kzc/repos","events_url":"https://api.github.com/users/kzc/events{/privacy}","received_events_url":"https://api.github.com/users/kzc/received_events","type":"User","site_admin":false},"created_at":"2016-10-04T16:23:50Z","updated_at":"2016-10-04T16:23:50Z","body":"It depends on whether you're using `--mangle-props` or `--mangle-props=2` (a.k.a. `--mangle-props=unquoted`)."}}
{"actor":{"display_login":"kzc"}}