From 564b292974db56b49dec0b3864bc3565e4895bc8 Mon Sep 17 00:00:00 2001 From: Nick Martin Date: Wed, 11 Jul 2012 23:03:26 -0700 Subject: [PATCH] Fix Meteor._debug on IE8,9 --- packages/logging/logging.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/logging/logging.js b/packages/logging/logging.js index 653ff1151f9..21f3954ac4e 100644 --- a/packages/logging/logging.js +++ b/packages/logging/logging.js @@ -22,7 +22,20 @@ // IE10 PP4 requires at least one argument console.log(''); } else { - console.log.apply(console, arguments); + // IE doesn't have console.log.apply, it's not a real Object. + // http://stackoverflow.com/questions/5538972/console-log-apply-not-working-in-ie9 + // http://patik.com/blog/complete-cross-browser-console-log/ + if (typeof console.log.apply === "function") { + // Most browsers + console.log.apply(console, arguments); + } else if (typeof Function.prototype.bind === "function") { + // IE9 + var log = Function.prototype.bind.call(console.log, console); + log.apply(console, arguments); + } else { + // IE8 + Function.prototype.call.call(console.log, console, Array.prototype.slice.call(arguments)); + } } } }; @@ -31,5 +44,5 @@ // stop tests from spamming the console. Meteor._suppress_log = function (count) { suppress += count; - } + }; })();