[Dev-flock] r435 - in huginmunin/trunk/web/hm: . app/media/js app/templates/test
dan@thoughtandmemory.org
dan at thoughtandmemory.org
Wed Dec 5 00:21:15 EST 2007
r442 at insignificant: dan | 2007-12-04 21:46:43 -0500
Fixed a problem with javascript inside client-side templates.
Before now, scripts inside templates could not reference themselves when rendered clientside, because the script would be executed before the HTML was inserted into the DOM. (That is, most javascript would work, but jQuery selectors could not target the template.)
Now, you can enclose scripts within {% script %} and it will render correctly:
- when rendered on the server, the <script type="text/javascript"> tags are used
- when rendered on the client, you can use Template.build to generate an object containing two attributes: 'html' and 'js'. You can eval() the 'js' attribute after inserting the 'html'.
Modified:
huginmunin/trunk/web/hm/
huginmunin/trunk/web/hm/app/media/js/json_template.js
huginmunin/trunk/web/hm/app/templates/test/js_template.html
huginmunin/trunk/web/hm/app/templates/test/tags.html
More information about the Dev-flock
mailing list