diff options
| author | Tobias Bosch | 2013-12-18 18:52:36 -0800 |
|---|---|---|
| committer | Tobias Bosch | 2013-12-18 21:44:00 -0800 |
| commit | 4f5758e6669222369889c9e789601d25ff885530 (patch) | |
| tree | 35869477885ec4e7afd9c1d6b7bc1656ac0fbb23 /src | |
| parent | 274a6734ef1fff543cc50388a0958d1988baeb57 (diff) | |
| download | angular.js-4f5758e6669222369889c9e789601d25ff885530.tar.bz2 | |
fix($log): should work in IE8
In IE8, reading `console.log.apply` throws an error.
Catching this errow now.
Fixes #5400. Fixes #5147.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ng/log.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/ng/log.js b/src/ng/log.js index c64e04f3..1d9a001a 100644 --- a/src/ng/log.js +++ b/src/ng/log.js @@ -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) { |
