From 863c3ec1fde8e1eb581f4aa8e1bd68241a7e55c0 Mon Sep 17 00:00:00 2001 From: Christophe Laffont Date: Wed, 11 Jun 2014 11:37:25 +0200 Subject: [PATCH] Avoid console errors Use script from HTML5 Boilerplate to avoid console errors. https://github.com/h5bp/html5-boilerplate/blob/master/js/plugins.js --- .../frontOffice/default/assets/js/script.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/templates/frontOffice/default/assets/js/script.js b/templates/frontOffice/default/assets/js/script.js index 86afde294..0cca40eaa 100644 --- a/templates/frontOffice/default/assets/js/script.js +++ b/templates/frontOffice/default/assets/js/script.js @@ -1,3 +1,26 @@ +// Avoid `console` errors in browsers that lack a console. +(function() { + var method; + var noop = function () {}; + var methods = [ + 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', + 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', + 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', + 'timeStamp', 'trace', 'warn' + ]; + var length = methods.length; + var console = (window.console = window.console || {}); + + while (length--) { + method = methods[length]; + + // Only stub undefined methods. + if (!console[method]) { + console[method] = noop; + } + } +}()); + /* JQUERY PREVENT CONFLICT */ (function ($) {