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

Console plugin: Object doesn't support property or method 'apply' #217

Closed
amk221 opened this issue Jun 2, 2014 · 4 comments
Closed

Console plugin: Object doesn't support property or method 'apply' #217

amk221 opened this issue Jun 2, 2014 · 4 comments

Comments

@amk221
Copy link

amk221 commented Jun 2, 2014

The console plugin errors in IE9 with Object doesn't support property or method 'apply' (example). Thoughts on using this to fix it?

@mattrobenolt
Copy link
Contributor

Is this just suggesting that I need to do:

Function.prototype.bind.call(originalConsoleLevel, originalConsole).apply(originalConsole, args);

instead?

@mattrobenolt
Copy link
Contributor

diff --git a/plugins/console.js b/plugins/console.js
index aac3e3e..a3cba91 100644
--- a/plugins/console.js
+++ b/plugins/console.js
@@ -19,7 +19,9 @@ var logForGivenLevel = function(level) {

         // this fails for some browsers. :(
         if (originalConsoleLevel) {
-             originalConsoleLevel.apply(originalConsole, args);
+             Function.prototype.bind
+                 .call(originalConsoleLevel, originalConsole)
+                 .apply(originalConsole, args);
         }
     };
 };

@amk221
Copy link
Author

amk221 commented Jun 2, 2014

Yes, I did try it and it worked, but I'm not 100% sure of the concequences in other browsers

@mattrobenolt
Copy link
Contributor

It works in Chrome, so that's good enough for me!

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

2 participants