3 ms·
I like that, except that templates are used on demand, so onload would be useless. A better way would be to put an id on them and defer their load for when real
by Kilimanjaro 14y ago
I like that, except that templates are used on demand, so onload would be useless. A better way would be to put an id on them and defer their load for when really needed.
<link hef='blog.html' rel='template' id='myblog' defer>
But still, we don't want to load 50 templates at the same time if the app is big then use one or two in that session, that's why loading them on demand with httprequest might be a better solution.
*Besides, being static in nature they would be cached on the server and client for instant access.
- MatthewPhillips 14y agoI threw together this gist which does your suggestion: https://gist.github.com/2955953 https://gist.github.com/2955953 Use like thus: var tmpl = document.getElementById('myblog').template;
- Kilimanjaro 14y agoBeautiful!