Skip to content
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

Workaround IE8 catch scope bug #4

Open
medikoo opened this issue Apr 8, 2015 · 1 comment
Open

Workaround IE8 catch scope bug #4

medikoo opened this issue Apr 8, 2015 · 1 comment

Comments

@medikoo
Copy link

medikoo commented Apr 8, 2015

In my setup mangle at somepoint generated similar code:

var a = function () {...};
try {
  ...
} catch (a) {
  ...
}
return a();

It works on most browsers, but it fails in IE8, where a is not local to catch scope, and overrides outer a.

It'll be great to have either hardcoded workaround for that, or at least an option that will allow us to produce IE8 valid code.

@medikoo medikoo changed the title Workaround IE8 try/catch bug Workaround IE8 catch scope bug Apr 8, 2015
@medikoo
Copy link
Author

medikoo commented Jan 18, 2017

Same applies to handling of function names, they're renamed not in context of surrounding scope, which of course is valid in ECMAScript, but error-prone for IE8 environment, as this name leaks to upper scope and we may have collisions, e.g.:

(function (foo) {
	var x = foo();
	return {
		elo: function elo() { .. }
	};
}());

Gets renamed to:

(function (a) {
	var b = a();
	return {
		elo: function a() { .. }
	};
}());

and in IE8 at var b = a() it's function that's assigned to elo property that's invoked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant