From f01cfd4a412cf6a9fbfdc7e59a45edca90c98f14 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 26 Jan 2015 14:33:09 +0000 Subject: [PATCH] Fix etemplate2 clear instance broken by commit 51394 --- etemplate/js/etemplate2.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/etemplate/js/etemplate2.js b/etemplate/js/etemplate2.js index c4ebecab89..9f1c49ce09 100644 --- a/etemplate/js/etemplate2.js +++ b/etemplate/js/etemplate2.js @@ -196,6 +196,19 @@ etemplate2.prototype.clear = function() this.widgetContainer = null; } $j(this.DOMContainer).empty(); + + // Remove self from the index + for(name in this.templates) + { + if(typeof etemplate2._byTemplate[name] == "undefined") continue; + for(var i = 0; i < etemplate2._byTemplate[name].length; i++) + { + if(etemplate2._byTemplate[name][i] == this) + { + etemplate2._byTemplate[name].splice(i,1); + } + } + } }; /**