Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix($log): should work in IE8
Browse files Browse the repository at this point in the history
In IE8, reading `console.log.apply` throws an error.
Catching this errow now.

Fixes #5400. Fixes #5147.
  • Loading branch information
tbosch committed Dec 19, 2013
1 parent 274a673 commit 4f5758e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/ng/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,16 @@ function $LogProvider(){

function consoleLog(type) {
var console = $window.console || {},
logFn = console[type] || console.log || noop;
logFn = console[type] || console.log || noop,
hasApply = false;

if (logFn.apply) {
// Note: reading logFn.apply throws an error in IE11 in IE8 document mode.
// The reason behind this is that console.log has type "object" in IE8...
try {
hasApply = !! logFn.apply;
} catch (e) {}

if (hasApply) {
return function() {
var args = [];
forEach(arguments, function(arg) {
Expand Down

0 comments on commit 4f5758e

Please sign in to comment.