From: Tim Düsterhus Date: Sat, 13 Apr 2013 16:55:32 +0000 (+0200) Subject: Provide a complete window.console dummy implementation X-Git-Tag: 2.0.0_Beta_1~370^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0af6180080bf980532810bb385bef78108284eb4;p=GitHub%2FWoltLab%2FWCF.git Provide a complete window.console dummy implementation --- 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); }; }