jquery-tmpl icon indicating copy to clipboard operation
jquery-tmpl copied to clipboard

Option to enable/disable tmplItem() support

Open yangjh opened this issue 14 years ago • 8 comments

The tmplItem() method can be quite useful, we can use associate the elements rendered by a template with the data used to create them, however, it also create lots of cache object, or data object in jQuery.cache. If I want to create a table of 1 million rows , and I want the data used to render them to be garbage collected asap. But this is not supported in the current implementation, because the tmplItem() needs the data. So the data cannot be garbage collected. If I don't need the feature of tmplItem(), I just want show the content, it would be nice that I can disable this association explicitly.

yangjh avatar Mar 05 '11 13:03 yangjh

Yes, completely agree. This feature is planned, probably with Beta2,

BorisMoore avatar Mar 05 '11 14:03 BorisMoore

Agreed. I want to show HTML in a textarea without the _tmplitem garbage being added.

btipling avatar Jun 01 '11 07:06 btipling

Oh nevermind. saw #42.

btipling avatar Jun 01 '11 08:06 btipling

+1, I'm having trouble because of this right now. I'm developing a one page app and my jQuery object keeps on growing because of all those cached tmplItems. Would be a very nice (and handy) feature!

mAu888 avatar Aug 19 '11 11:08 mAu888

If you don't need the tmplItem, maybe you should try another template lib jsRender, but you can cleanup these object manually, they are stored in the dataobject of each root of the rendered instance. On Aug 19, 2011 7:42 AM, "mAu888" < [email protected]> wrote:

+1, I'm having trouble because of this right now. I'm developing a one page app and my jQuery object keeps on growing because of all those cached tmplItems. Would be a very nice (and handy) feature!

Reply to this email directly or view it on GitHub: https://github.com/jquery/jquery-tmpl/issues/80#issuecomment-1850209

yangjh avatar Aug 19 '11 14:08 yangjh

After some debugging and profiling I figured, that all those tmplItems where created by using the {{html}} tag. Maybe I'm wrong, but for now I switched the template engine and my memory leak went away.

Anybody may have a look into the {{html}} tag and check if it's leaking?

mAu888 avatar Aug 23 '11 10:08 mAu888

Thanks for taking the time to submit this issue. Just wanted to let you know this plugin is no longer being actively developed or maintained by the jQuery team. See README for more info.

rdworth avatar Oct 08 '11 06:10 rdworth

The ongoing work on JsViews and JsRender separates out the tmpItem aspect into JsViews. Just use JsRender if you want optimized rendering without data context or linking. Take a look at this post for more context.

BorisMoore avatar Oct 13 '11 19:10 BorisMoore