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

IE9 console patch fails: console.log has no apply method #329

Closed
rigeroso opened this issue Feb 1, 2013 · 2 comments · Fixed by #538
Closed

IE9 console patch fails: console.log has no apply method #329

rigeroso opened this issue Feb 1, 2013 · 2 comments · Fixed by #538

Comments

@rigeroso
Copy link

rigeroso commented Feb 1, 2013

IE9's console.log returns typeof "object" and does not have an apply method. That causes the console patch to fail:

    // patch the console
    (function(window, tc) {
      var console = window.console = window.console || {log: function() {}};
      var browserConsoleLog = console.log;

      console.log = function() {
        tc.info({dump: Array.prototype.slice.call(arguments, 0)});
        return browserConsoleLog.apply(console, arguments);
      };
    })(window, window.__testacular__);

IE's console object is only available, when the dev Tools are open.

http://stackoverflow.com/questions/5538972/console-log-apply-not-working-in-ie9?rq=1

@bitwiseman
Copy link
Contributor

What version are you using? The lastest canary build (0.5.9) may address this.

@vojtajina
Copy link
Contributor

Nope, I don't think the change in 0.5.9 fixed this issue.

I guess the issue is only if you have the console open (as IE does not have window.console defined otherwise). Then, we try to call .apply() on it. And IE is super stupid and does not have it. There's a workaround for it (call Function.prototype.apply instead). If it really bothers you, send a PR.

timbertson added a commit to timbertson/karma that referenced this issue May 8, 2013
Use Function.prototype.apply.call(log, ...) instead of log.apply(...)
to avoid an error when IE's console is open.

Closes karma-runner#329
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

Successfully merging a pull request may close this issue.

3 participants