Rivets.js - Binding data to views(rivetsjs.com) |
Rivets.js - Binding data to views(rivetsjs.com) |
Change a tag name or class name (which I think is far more common than attribute names) would then break the relationship.
This could be used with backbone or any other lib that doesn't have data binds.
Since it would make no apparent sense to use both KO and Rivet, the original question seems germane.
Is the answer then "because Rivets does less"?
https://github.com/mikeric/rivets/blob/master/src/rivets.cof...
... although one thing to note is that it looks like it doesn't currently support IE (< 9).
To summarize; Not only do I think this is excessive beyond MVC, but it is also jumping the gun by a decade minimum. I don't need smarty templates, I don't need overloaded HTML attributes and I don't need this. Good day to you.
I'm really curious, is there a better way?
I don't want to wrap my models with ugly frameworks, all I need is a way to fire a callback when my model changes.
There is a lot of talk on various MVC frameworks, but lets not forget that manual syncing of views and models has some advantages, e.g. you can improve performance by combining many subsequent DOM operations or by temporarily detaching the parent from DOM tree.
https://adamsanderson.github.com/ivy/
Lots of people are looking for better ways to deal with data in their views :)
Also, when a data value changes do you re-render the whole thing, of just the affected node?
It just updates the specified part (data-value updates the value, data-html updates the innerHTML etc)
Rendering the whole view again can be expensive. As well as this the user might have interacted with the page in which would probably make the user loose his changes.
But thats for us, we do development on a framework we've built thats based on Backbone's elements (but thats just a part) one of the attractive things about Knockout has been its data-binding. So we'll look at this to see if we can add it to our stack.
One thing we really like about Backbone is you can rip out the component parts (Models, Views, Events etc) and add them to your own stack/framework, this seems like an extension of that model, which works well for us. Not that knockout does "too much" we could likely switch to using knockout, but that would likely be a big change to the stack we use. This is something smaller that we can add to our existing code without worrying too much.
One big upside to knockout is that the lib is a little under 3KB minified while knockout is 40KB minified.
I prefer having smaller libraries that are really good at what they do.
It is nothing like Backbone, which really seems to want you to write a "Backbone" app.