DomTemplate Example

During templating you may need to get access to the current element. Sometimes there's just no nice way to describe what you need to do, so the __element tracks the element that is under examination.

HTML

<script src="https://github.com/PAEz/domtemplate/raw/master/lib/domtemplate.js"></script>
<script src="https://github.com/PAEz/domtemplate/raw/master/lib/promise.js"></script>
<div id="ex11" class="bar">${console.log(__element.className);''}</div>

JavaScript

template('ex11', null, { allowEval: true });