From 343ad287617b42f287f372ba6d7edc3cc0d728bf Mon Sep 17 00:00:00 2001 From: Matt Lott Date: Sun, 7 Dec 2014 15:24:12 -0800 Subject: [PATCH] Fix IE9 missing console object Debugging IE9 without debugging tools, when the debugging tools are kind of the problem. Fun. --- app/core/initialize.coffee | 7 +++++++ app/models/CocoModel.coffee | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/app/core/initialize.coffee b/app/core/initialize.coffee index 159fe627b..a3033feac 100644 --- a/app/core/initialize.coffee +++ b/app/core/initialize.coffee @@ -77,6 +77,13 @@ initializeUtilityServices = -> require('core/services/segmentio')() setupConsoleLogging = -> + # IE9 doesn't expose console object unless debugger tools are loaded + unless console? + window.console = + info: -> + log: -> + error: -> + debug: -> unless console.debug # Needed for IE10 and earlier console.debug = console.log diff --git a/app/models/CocoModel.coffee b/app/models/CocoModel.coffee index 1d7c7439d..e0e1be276 100644 --- a/app/models/CocoModel.coffee +++ b/app/models/CocoModel.coffee @@ -19,6 +19,13 @@ class CocoModel extends Backbone.Model @on 'error', @onError, @ @on 'add', @onLoaded, @ @saveBackup = _.debounce(@saveBackup, 500) + # IE9 doesn't expose console object unless debugger tools are loaded + unless console? + window.console = + info: -> + log: -> + error: -> + debug: -> console.debug = console.log unless console.debug # Needed for IE10 and earlier setProjection: (project) ->