4 ms·
Here's a code snippet from the website: <div class="listView win-selectionstylefilled" data-win-control="WinJS.UI.ListView" data-win-opti
by jasim 11y ago
Here's a code snippet from the website:
<div class="listView win-selectionstylefilled"
data-win-control="WinJS.UI.ListView"
data-win-options="{
itemDataSource: Sample.ListView.data.dataSource,
itemTemplate: select('.smallListIconTextTemplate'),
header: select('.header'),
selectionMode: 'none',
tapBehavior: 'none',
layout: { type: WinJS.UI.ListLayout }
}">
</div>
The ListView control looks quite powerful, but unfortunately that power comes at the cost of learning a new templating language and all its quirks. Where is the `select` method defined? Is it user accessible Javascript, or is it hidden deep inside the library? What if I wanted to capitalize my headers - would `data-win-options` evaluate Javascript? If it does, what is its binding? Does it use a custom expression parser? If so, what are its quirks? How do I create a reusable component out of this? How would I parameterize it?
There are a few custom tags here: 'data-win-control', 'data-win-options' and 'data-win-bind'. How many others are there, and how much time would I have to spend in their API docs to grok them?
Having worked with ERB, HAML, and Angular extensively, and after dabbling with Mustache, and thus relearning a different way to do the same thing over and over, it has become apparent to me that templating languages ought to do string interpolation and stop at that and leave the programming part to a programming language.