incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmarga...@apache.org
Subject svn commit: r492337 - in /incubator/xap/trunk/src/xap/bridges: basic/AbstractWidgetBridge.js dojo/DojoWidgetBridge.js
Date Wed, 03 Jan 2007 22:57:20 GMT
Author: jmargaris
Date: Wed Jan  3 14:57:20 2007
New Revision: 492337

URL: http://svn.apache.org/viewvc?view=rev&rev=492337
Log:
Some memory leak fixes, calling destroy() on dojo components
and cleaning up some of the saved event hooks

Modified:
    incubator/xap/trunk/src/xap/bridges/basic/AbstractWidgetBridge.js
    incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js

Modified: incubator/xap/trunk/src/xap/bridges/basic/AbstractWidgetBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/basic/AbstractWidgetBridge.js?view=diff&rev=492337&r1=492336&r2=492337
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/basic/AbstractWidgetBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/basic/AbstractWidgetBridge.js Wed Jan  3 14:57:20
2007
@@ -25,6 +25,7 @@
 Xap.require("dojo.event.*") ;
 Xap.require("xap.session.ClientEvent");
 Xap.require("dojo.html.*");
+Xap.require("xap.util.ArrayHelper");
  
 /**
  *  @fileoverview
@@ -76,7 +77,18 @@
 Xap.setupClassAsSubclassOf("xap.bridges.basic.AbstractWidgetBridge","xap.taghandling.AbstractTagImpl");
 
 
-
+/**
+ * Helper function to clean up a DOM node that was used with dojo.event.connect()
+ * or other dojo methods.
+ */
+xap.bridges.basic.AbstractWidgetBridge.cleanNode = function(node){
+	var tna = node.all || node.getElementsByTagName("*");
+	dojo_ie_clobber.clobber(node);
+	xap.util.ArrayHelper.removeElement(dojo_ie_clobber.clobberNodes,node);
+	for (var i = 0; i<tna.length;i++){
+		xap.util.ArrayHelper.removeElement(dojo_ie_clobber.clobberNodes,tna[i]);
+	}
+}
 
 
 /**
@@ -104,6 +116,14 @@
 	xap.taghandling.AbstractTagImpl.prototype.init.call( this );
 	
 
+}
+
+xap.bridges.basic.AbstractWidgetBridge.prototype.unload = function() {
+	var rootNode = this.getRootDomNode();
+	if (rootNode){
+		xap.bridges.basic.AbstractWidgetBridge.cleanNode(rootNode);
+	}
+	xap.taghandling.AbstractTagImpl.prototype.unload.call( this );
 }
 
 /**

Modified: incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js?view=diff&rev=492337&r1=492336&r2=492337
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js Wed Jan  3 14:57:20 2007
@@ -69,6 +69,15 @@
 
 
 
+/**
+ * 
+ * @return an object mapping allowed initial
+ * XAL properties to their Dojo equivalents
+ */
+ xap.bridges.dojo.DojoWidgetBridge.prototype.unload = function(){
+ 	xap.bridges.basic.AbstractWidgetBridge.prototype.unload.call(this);
+ 	this.getPeer().destroy();
+ }
 
 
  /**



Mime
View raw message