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

$.tmpl returns lots of <TextNode> elements

Open marlun78 opened this issue 13 years ago • 4 comments

I know the project has been canceled, but it would be nice if someone who knows how could fix this problem.

marlun78 avatar Nov 10 '11 10:11 marlun78

You would need to post a simple test case to jsfiddle, for someone to help you here. It may be your issue is an error in your code, or template, not in jquery.tmpl....

BorisMoore avatar Nov 10 '11 18:11 BorisMoore

Yeah, sorry about that! It was not a jquery.tmpl problem. Well sort of. The problem had to do with whitespace in the template file. Once I removed that, it worked fine.

marlun78 avatar Jan 03 '12 18:01 marlun78

I am getting the same issue, but I have no white spaces. In the meantime:

This returns a TextNode? $('

${Text}
').tmpl(instance)

...and yes, instance contains a property called 'Text' (e.g. instance.Text )

This returns EMPTY? $("

").tmpl(instance)

This returns EMPTY? $('

').tmpl({})

PrisonerZERO avatar Jul 31 '12 12:07 PrisonerZERO

First and foremost, each template needs a wrapper.. This is a dummy tag. Any template not contained in a script tag must be wrapped within a dummy tag. (this is probably because the resulting selectors “HTML()” method is used to return desired markup). Additionally, invalid html will cause it to return empty object. For example, putting a td tag inside a div.

Also see http://bugs.jquery.com/ticket/7188

ChrisMalone avatar Jul 31 '12 13:07 ChrisMalone