From 7f12f35feaabb5f4a7cc28b1552e96ea2d5794bc Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Wed, 22 Jan 2014 16:28:17 -0800 Subject: [PATCH] Added code that removes the views when a model/widget is closed. --- IPython/html/static/notebook/js/widgets/widget.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/IPython/html/static/notebook/js/widgets/widget.js b/IPython/html/static/notebook/js/widgets/widget.js index 7d8579a95..b0080452d 100644 --- a/IPython/html/static/notebook/js/widgets/widget.js +++ b/IPython/html/static/notebook/js/widgets/widget.js @@ -65,7 +65,9 @@ function(WidgetManager, Underscore, Backbone){ delete this.comm.model; // Delete ref so GC will collect widget model. delete this.comm; delete this.model_id; // Delete id from model so widget manager cleans up. - // TODO: Handle deletion, like this.destroy(), and delete views, etc. + _.each(this.views, function(view, i) { + view.remove(); + }); }, _handle_comm_msg: function (msg) {