From 657658b9920ac2533e58df3d50258a96b151793c 2014-11-25 01:44:35
From: Jason Grout <jgrout6@bloomberg.net>
Date: 2014-11-25 01:44:35
Subject: [PATCH] Add comments emphasizing the order of steps in widget box remove() methods

---

diff --git a/IPython/html/static/widgets/js/widget_box.js b/IPython/html/static/widgets/js/widget_box.js
index 7fdc20c..a8c6fd8 100644
--- a/IPython/html/static/widgets/js/widget_box.js
+++ b/IPython/html/static/widgets/js/widget_box.js
@@ -79,6 +79,9 @@ define([
         },
         
         remove: function() {
+            // We remove this widget before removing the children as an optimization
+            // we want to remove the entire container from the DOM first before
+            // removing each individual child separately.
             BoxView.__super__.remove.apply(this, arguments);
             this.children_views.remove();
         },
diff --git a/IPython/html/static/widgets/js/widget_selectioncontainer.js b/IPython/html/static/widgets/js/widget_selectioncontainer.js
index 61a517f..b2b2c26 100644
--- a/IPython/html/static/widgets/js/widget_selectioncontainer.js
+++ b/IPython/html/static/widgets/js/widget_selectioncontainer.js
@@ -128,6 +128,9 @@ define([
         },
         
         remove: function() {
+            // We remove this widget before removing the children as an optimization
+            // we want to remove the entire container from the DOM first before
+            // removing each individual child separately.
             AccordionView.__super__.remove.apply(this, arguments);
             this.children_views.remove();
         },
@@ -252,6 +255,9 @@ define([
         },
         
         remove: function() {
+            // We remove this widget before removing the children as an optimization
+            // we want to remove the entire container from the DOM first before
+            // removing each individual child separately.
             TabView.__super__.remove.apply(this, arguments);
             this.children_views.remove();
         },