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

$jQuery.tmpl error for empty strings

Open 2beers opened this issue 14 years ago • 5 comments

Firefox error console return the following error:

Error: $.tmpl("", {title: "some title"}).appendTo is not a function

I used the following code: $.tmpl("", {title:"some title"}).appendTo("#element");

If I change the template string with something else than an empty string everything works ok. $.tmpl(" ", {title:"some title"}).appendTo("#element"); // this works OK

Hope this helps

2beers avatar Apr 28 '11 14:04 2beers

You are using a template with no content here. Is that your goal?

BorisMoore avatar Apr 28 '11 17:04 BorisMoore

yes. I know I can make a check to see if the template is empty , but I though this might be an error so I reported. I think it's more a problem of debate. To me even if the template has no content it shouldn't throw an error, it will just return ""

2beers avatar Apr 28 '11 17:04 2beers

OK, thanks. I'll keep this open for considering adding in that support.

BorisMoore avatar Apr 28 '11 17:04 BorisMoore

TODO See corresponding fix https://github.com/BorisMoore/jsrender/commit/5a579d233c9830785ffcde734c63ab2490da3b0e

BorisMoore avatar Jun 16 '11 00:06 BorisMoore

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