« Efficiently doing... stuff... using .NET delegates | Main | About the Authors: Rob Huffstedtler »



Feed You can follow this conversation by subscribing to the comment feed for this post.

Scott LEwis

Aaron, I can certainly see the usefulness of JSTemplating. I wonder, though, what are your thoughts with regards to the impact on the document semantics?

Aaron Romine

That's a very good question.

Obviously the first impact is that meaning is being transferred from context to client side templates. Loosing that context means your page is less machine readable - and that most of your 'content' lives (presumably) in AJAX calls. This is true however with anything dynamically written. I think the strengths of this approach to templating lies in developing a richer UI more quickly. Providing fallback and accessibility as well as machine accessible semantics is a lot to tackle while maintaining a rich UI.

If your looking at it from a more correctness approach (e.g. using a script tag to hold page mark-up), that is somewhat troublesome. The script tag's type attribute works just like any other mime-type attribute - telling the browser how to process the content's of the tag. The assumption is that a browser won't evaluate a script tag with a 'type' of 'text/html' since it doesn't have a script engine for that mime type. This has desired 'ignore' effect in every major browser I've tried. So from a pragmatic point of view - it works, and is somewhat more elegant than placing them in div's or JS literal strings. That being said it's using the script tag in a way it wasn't meant to be used (at least directly). If you think about it, the content of the tag is still script related, but the original semantics aren't the same. What it accomplishes is a way to have the browser completely ignore the contents of the node. This is extremely helpful when writing templates, as the content of the node may or may not be valid HTML, and mostly definitely isn't desired to be displayed without being evaluated.

Of course this whole approach has it's ups and downs. Most of the templating solutions I've reviewed rely on innerHTML as a setter, which has some major limitations (for instance: tables). I usually resort to using the DOM (slow but it's getting faster and faster). I'll have to look around for some of my old code that used a JSON syntax for creating templates. Not nearly as natural as straight up markup - but much more flexible.


Do you think Jon Resig's solution is production-ready or just a clever experiment? Also, do you see this type of solution becoming obsolete or unnecessary once client-side storage is supported by all of the major browsers?

The comments to this entry are closed.

Contact ICF Ironworks

  • ICF Ironworks combines strategy, technology and design services to assist clients in the development of large-scale, complex technology projects. Ironworks offers three core services: Business & IT Alignment, Portal and Content Management, and Interactive.

    Contact us for help with your next project.

ICF Ironworks is Hiring!

  • If you're the best... we want you to work here!

    If you're the best... we want you to work here!ICF Ironworks is always on the lookout for experienced professionals who believe in hard work, having fun, and great client service.

    View our open positions, or, if you don't see an exact match, send us your resume.

Workswire e-Newsletter

  • Workswire e-newsletterSign up to receive Ironworks' quarterly e-newsletter for the latest news, events, client successes, industry insights and more!

About This Blog

Welcome to the Ironworks Technology Blog, Under the Hood. Ironworks has nominated solicited employee volunteers to write about various technology-related topics, from high-level application architecture all the way down to those pesky 1s and 0s that keep the world moving these days.

Continue reading »

Ironworks Twitter Updates

    follow me on Twitter

    Other Blogs We Love

    • TED | Talks | List
    • Information Architects
      We architect information.
    • John Resig - Blog
      John Resig is the Dean of Open Source and head of JavaScript development at Khan Academy and the author of the book Pro JavaScript Techniques. He’s also the creator and lead developer of the jQuery JavaScript library.
    • Iconify.it
      Welcome to Iconify.it – a blog about icons.
    • Garrett's Tech Musings
      Thoughts on technology, programming, and the industry
    • Fit and Finish
      Insight from the Ironworks User Experience Group
    • Fritillaria
      Information Architecture Across Dimensions
    • Amusingly MOSS
      ...It's funny how difficult some stuff is when it really shouldn't be
    • CAE Weblog
      Ramblings about the world of associations and their intersection with the Web.

    Become a Fan