block by jkutianski 7475950

A new attempt to add templating to d3.js

Full Screen

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:

index.html

d3.selection.template.js