mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
fix($log): should work in IE8
In IE8, reading `console.log.apply` throws an error. Catching this errow now. Fixes #5400. Fixes #5147.
This commit is contained in:
parent
274a6734ef
commit
4f5758e666
1 changed files with 9 additions and 2 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue