From 0af6180080bf980532810bb385bef78108284eb4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Sat, 13 Apr 2013 18:55:32 +0200 Subject: [PATCH] Provide a complete window.console dummy implementation --- wcfsetup/install/files/js/WCF.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 7b31b9941e..d95feee8c8 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -37,13 +37,16 @@ return $data; }; - // provide a sane console.debug implementation - if (!window.console) { - window.console = { - debug: function() { /* discard log */ } - }; + // provide a sane window.console implementation + if (!window.console) window.console = { }; + var consoleProperties = [ "log",/* "debug",*/ "info", "warn", "exception", "assert", "dir", "dirxml", "trace", "group", "groupEnd", "groupCollapsed", "profile", "profileEnd", "count", "clear", "time", "timeEnd", "timeStamp", "table", "error" ]; + for (var i = 0; i < consoleProperties.length; i++) { + if (typeof (console[consoleProperties[i]]) === 'undefined') { + console[consoleProperties[i]] = function () { } + } } - else if (typeof(console.debug) === 'undefined') { + + if (typeof(console.debug) === 'undefined') { // forward console.debug to console.log (IE9) console.debug = function(string) { console.log(string); }; } -- 2.20.1