I'm using javascript along with jQuery to render the closure templates (soy templates). I'm follwing its hello world example.
My jsfiddle here .
As described in the example, the following code works,
document.write(soy.examples.simple.helloWorld());
& provides
Hello world!
But when used along with jQuery to dynamically insert the closure template's content, its always returns empty, nothing gets appended.
$('#withoutContent').append(soy.examples.simple.helloWorld());
Ironically,on further looking, the following jQuery works correctly
$('#withContent').append(soy.examples.simple.helloWorld().content);
i'm facing this issue while upgrading from a very old version of closure templates. We have a lot of such templates, updating each one's usage in javascript to use .content
is cumbersome & errorprone.
Why isn't jQuery able to properly get the contents of the template??