[richfaces-svn-commits] JBoss Rich Faces SVN: r13343 - trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Wed Apr 1 11:26:59 EDT 2009


Author: pyaschenko
Date: 2009-04-01 11:26:59 -0400 (Wed, 01 Apr 2009)
New Revision: 13343

Modified:
   trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
https://jira.exadel.com/browse/SC-449
https://jira.jboss.org/jira/browse/RF-6672

Modified: trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js	2009-04-01 13:53:35 UTC (rev 13342)
+++ trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js	2009-04-01 15:26:59 UTC (rev 13343)
@@ -27,7 +27,6 @@
 		return e;
 }
 
-
 RichFaces.Menu.Layers = {
 	listl: new Array(),
 	father: {},
@@ -75,6 +74,23 @@
 	showTimeoutLength: 0,
 	queuedId : '',
 
+	destroy: function () {
+		this.listl = null;
+		this.father = null;
+		var obj;
+		for (var name in this.layers) {
+			obj = this.layers[name];
+			obj.layer = null;
+			obj.items = null;
+			$A(obj.bindings)
+   			.each(
+   				function(binding){
+   					binding.remove();
+   				}
+   			);
+		}
+		this.layers = null;
+	},
 
 	LMPopUp:function(menuName, isCurrent, event) {
 		if (!this.loaded || ( this.isVisible(menuName) && !isCurrent)) {
@@ -86,7 +102,7 @@
 			this.LMPopUpL(menuName, true, event);
 		} else {
 			//this.shutdown();
-			foobar = menuName;
+			var foobar = menuName; //PY: var added
 			do {
 				this.LMPopUpL(foobar, true, event);
 				foobar = this.father[foobar];
@@ -287,6 +303,13 @@
 	}
 };
 
+if (window.attachEvent) {
+    window.attachEvent("onunload", function() {
+    	var layers = RichFaces.Menu.Layers;
+    	layers.destroy();
+	});
+}
+
 /**
  * return true if defined document element or document body, otherwise return false
  */
@@ -844,7 +867,7 @@
  		this.bindings.push(binding);
  		binding.refresh();
 
-        arrayinp=$A(this.layer.getElementsByTagName("select"));
+        var arrayinp=$A(this.layer.getElementsByTagName("select")); // PY: var added
         for(i=0; i<arrayinp.length; i++){
 					var openSelectb = this.openSelect.bindAsEventListener(this);
 					var closeSelectb = this.closeSelect.bindAsEventListener(this);
@@ -1264,6 +1287,13 @@
 			return true;
 		}
 		return false;
+	},
+	remove:function(){
+		var obj = $(this.objectId);
+		if (obj) {
+			Event.stopObserving(obj, this.eventname, this.handler);
+			this.handler=null;
+		}
 	}
 };
 RichFaces.Menu.Items = {




More information about the richfaces-svn-commits mailing list