I wish to use jsViews in a widget that can be added/removed from the DOM multiple times.
If the widget runs code like this during creation:
if(!$.link.widgetTemplate)
{
$.templates({ widgetTemplate: "#widgetTemplateSrc" });
}
$.link.widgetTemplate("#myElement", someData);
Would $("#myElement").remove();
cause a memory leak or would jsViews get properly disposed?
How do you unload jsviews if you do not wish to remove #myElement
from the DOM?
Yes, removing elements using jQuery methods such as .remove(), .empty(), .html() will trigger disposal in JsViews, and should not lead to memory leaks.