All examples By author By category About

jkutianski

A new attempt to add templating to d3.js

D3.js templating test based on my previous solution of John Berryman's attempt.

ICahnHaz.js uses <script></script> and I preffer the idea of Eric Bidelman. The <template> element is currently supported in Chrome, Firefox and Opera (15+)for now.

Because the use of innerHTML run-time string parsing of user-supplied data can easily lead to XSS vulnerabilities and isn't supported by SVGElement, I use now XMLSerializer() and DOMParser() to inject the templates into the DOM. The callTemplate function uses querySelector and isn't limitted to Mustache.

Fork me @ GITHUB

TODOs: