Skip to content

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 angular#5400. Fixes angular#5147.
  • Loading branch information
tbosch authored and jamesdaily committed Jan 27, 2014
1 parent 283e930 commit 28f3e34
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 28f3e34

Please sign in to comment.