Author: nbelaevski
Date: 2009-01-05 10:33:09 -0500 (Mon, 05 Jan 2009)
New Revision: 12101
Modified:
trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js
Log:
https://jira.jboss.org/jira/browse/RF-5503
https://jira.jboss.org/jira/browse/RF-5499
Modified:
trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js
===================================================================
---
trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js 2009-01-05
15:32:50 UTC (rev 12100)
+++
trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js 2009-01-05
15:33:09 UTC (rev 12101)
@@ -182,13 +182,18 @@
},
destroy: function() {
- this.elements = undefined;
-
- //TODO remove check
if (this.parent) {
this.parent.removeChild(this);
}
+ if (this.elements) {
+ //free circular reference.
+ //
+ //TODO: contents of this.elements collection can still be used after item destruction,
+ //free them in future
+ this.elements.itemElement = undefined;
+ }
+
this.clearChildren();
if (this == this.tree.selectionManager.activeItem) {
@@ -252,7 +257,13 @@
props[Richfaces.TreeExpandEvent] = true;
props["expandedNode"] = this.id;
props["treeItem"] = this;
- Richfaces.createEvent("click", this.tree.element, null, props).fire();
+
+ var event = Richfaces.createEvent("click", this.tree.element, null, props);
+ try {
+ event.fire();
+ } finally {
+ event.destroy();
+ }
},
fireCollapsionEvent: function() {
@@ -260,7 +271,13 @@
props[Richfaces.TreeCollapseEvent] = true;
props["collapsedNode"] = this.id;
props["treeItem"] = this;
- Richfaces.createEvent("click", this.tree.element, null, props).fire();
+
+ var event = Richfaces.createEvent("click", this.tree.element, null, props);
+ try {
+ event.fire();
+ } finally {
+ event.destroy();
+ }
},
toggleCollapsion: function() {
@@ -425,8 +442,13 @@
props["originatingEventType"] = e.type;
props["treeItem"] = this;
props["selectedNode"] = this.id;
+
var evt = Richfaces.createEvent("click", this.tree.element, null, props);
- evt.fire();
+ try {
+ evt.fire();
+ } finally {
+ evt.destroy();
+ }
return !evt.event["cancelSelection"];
} else {