[Dojo-checkins] bill - r15332 - dijit/trunk/layout

dojo-checkins-admin at dojotoolkit.org dojo-checkins-admin at dojotoolkit.org
Thu Sep 25 08:36:08 UTC 2008


Author: bill
Date: Thu Sep 25 01:36:04 2008
New Revision: 15332

Modified:
   dijit/trunk/layout/ContentPane.js
Log:
Fixes #7709: ContentPane was destroying child widgets twice after the initial attr('content', ...) call, since destroyDescendants() was being called and dojo.html._ContentSetter was also destroying the widgets.
!strict

Modified: dijit/trunk/layout/ContentPane.js
==============================================================================
--- dijit/trunk/layout/ContentPane.js	(original)
+++ dijit/trunk/layout/ContentPane.js	Thu Sep 25 01:36:04 2008
@@ -377,9 +377,32 @@
 		}
 	},
 
+	destroyDescendants: function(){
+		// summary:
+		//		Destroy all the widgets inside the ContentPane
+
+		// dojo.html._ContentSetter keeps track of child widgets, so we should use it to
+		// destroy them.
+		//
+		// Only exception is when those child widgets were specified in original page markup
+		// and created by the parser (in which case _ContentSetter doesn't know what the widgets
+		// are).  Then we need to call Widget.destroyDescendants().
+		//
+		// Note that calling Widget.destroyDescendants() has various issues, namely that
+		// popup widgets aren't destroyed (#2056, #4980)
+		// and the widgets in templates are destroyed twice (#7706)
+		var setter = this._contentSetter; 
+		if(setter){
+			setter.empty();
+		}else{
+			this.inherited(arguments);
+		}
+	},
+
 	_setContent: function(cont){
 		// summary: 
-		//	insert the content into the container node, 
+		//		Insert the content into the container node
+
 
 		// first get rid of child widgets
 		this.destroyDescendants();


More information about the Dojo-checkins mailing list