Message from JavaScript discussions

July 2017

— Wait, how will it know if the data changes?


<!-- Template Container Element -->

<script id="myTemplate">

  <div data-content-text="myTag" data-content-text-format="myFormatter"></div>


<!-- Destination Element -->

<div id="myContainer"></div>

— Is it two-way?

— One-way

— So if it changes, you have to run it again, but I am planning on adding a watcher

— Object.observe is coming

— Result, loaded template:

<div id="myContainer">

— ES8

— The jquery-template author has a formatter scheme which I find nasty

— Mine is much simpler by simply targeting the data injector attribute, then followed by -format

— One attribute per formatter, whereas his has up to 3

— For now I will just provide a callback and a patch function