diff --git a/notebook/static/notebook/js/outputarea.js b/notebook/static/notebook/js/outputarea.js index be1ffa89d..c785a2fa1 100644 --- a/notebook/static/notebook/js/outputarea.js +++ b/notebook/static/notebook/js/outputarea.js @@ -54,7 +54,18 @@ define([ **/ OutputArea.prototype.create_elements = function () { - this.element = $("
"); + var element = this.element = $("
"); + // wrap element in safe trigger, + // so that errors (e.g. in widget extensions) are logged instead of + // breaking everything. + this.element._original_trigger = this.element.trigger; + this.element.trigger = function (name, data) { + try { + this._original_trigger.apply(this, arguments); + } catch (e) { + console.error("Exception in event handler for " + name, e, arguments); + } + } this.collapse_button = $("
"); this.prompt_overlay = $("
"); this.wrapper.append(this.prompt_overlay);