Check for old template and clear it before loading a new template into same DOM node

Prevents action corruption in home when new etemplate is loaded before old one is cleared.
This commit is contained in:
Nathan Gray 2016-02-23 21:18:33 +00:00
parent 4c307f7d1f
commit 009b5b72e7

View File

@ -1141,6 +1141,13 @@ function etemplate2_handle_load(_type, _response)
var node = document.getElementById(data.DOMNodeID);
if(node)
{
if(node.children.length)
{
// Node has children already? Check for loading over an
// existing etemplate
var old = etemplate2.getById(node.id);
if(old) old.clear();
}
var et2 = new etemplate2(node);
et2.load(data.name, data.url, data.data);
return true;