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

Function.name property used - fails in IE #61

Open
briebug opened this issue Jun 28, 2014 · 1 comment
Open

Function.name property used - fails in IE #61

briebug opened this issue Jun 28, 2014 · 1 comment

Comments

@briebug
Copy link

briebug commented Jun 28, 2014

Love the project, not sure if anyone is actively working on issues. I am seeing that this library does not work with IE at all due to the use of the ECMAScript6 function.name which is not supported at all by IE. I see 17 instances of klass.name in the source code.

Any plans on updating this so that it will work with IE?

Cheers

@nodesfactory
Copy link

Hi,

I am having the same problem as you. Pending a fix for internet explorer, I have applied the following solution, to monkey patch internet explorer :

if (Function.prototype.name === undefined && Object.defineProperty !== undefined) {
    Object.defineProperty(Function.prototype, 'name', {
        get: function() {
            var funcNameRegex = /function\s([^(]{1,})\(/;
            var results = (funcNameRegex).exec((this).toString());
            return (results && results.length > 1) ? results[1].trim() : "";
        },
        set: function(value) {}
    });
}

This is certainly not ideal, but it solves the problem ;)

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