From ad944b93f3bfde234033e2d9cb9cfff23e680387 Mon Sep 17 00:00:00 2001 From: Greg MacLellan Date: Tue, 13 Nov 2012 13:03:16 -0500 Subject: [PATCH] Support console.log in IE9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit IE9 does console incorrectly, this fixes according to http://stackoverflow.com/questions/5538972/console-log-apply-not-working-in-ie9 --- src/main/javascript/doc.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/javascript/doc.js b/src/main/javascript/doc.js index fad24eb9..9b55a658 100644 --- a/src/main/javascript/doc.js +++ b/src/main/javascript/doc.js @@ -65,7 +65,15 @@ function clippyCopiedCallback(a) { function log() { if (window.console) console.log.apply(console,arguments); } - +// Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913) +if (Function.prototype.bind && console && typeof console.log == "object") { + [ + "log","info","warn","error","assert","dir","clear","profile","profileEnd" + ].forEach(function (method) { + console[method] = this.bind(console[method], console); + }, Function.prototype.call); +} + var Docs = { shebang: function() {