Very nice.
I'm disappointed to see JavaScript back in attributes though. Can the bindings be defined programmatically?
I'm disappointed to see JavaScript back in attributes though. Can the bindings be defined programmatically?
http://github.com/SteveSanderson/knockout/blob/master/src/bi...
Perhaps Steve can comment on how well this performs in real-world views with thousands of DOM elements...
<button data-bind="click: function() { allItems.sort() }, enable: allItems().length > 1">
Sort
</button>It's so much more convenient to do it this way (avoiding having to figure out where each bit of behaviour comes from), especially when you're generating UI from within templates.
I've been massacring functions that manipulate multiple elements and instead am directly tying the behaviors to the underlying data. My future self is very pleased with me.