Are there any client-side JavaScript MVC (micro-)frameworks?
I have a rather complicated HTML form, and it would benefit from the MVC pattern.
I imagine a good solution would provide the following:
- Model and View update the Controller when values change (Observer pattern)
- Populate the model from the form data when the page loads
- Populate the form from the model when the model changes
Ajax, comet, JSONP and all that jazz are serious overkill.
There is the popular Backbone.js
Try this jQuery based javascript MVC framework.
Spine has an API similar to Backbone but it's a lot smaller. It features prototypal inheritance.
JavaScriptMVC is an excellent solution. It's everything is a plugin approach enables you to select only the features you need. As of 2.0, it's based on jQuery.
On progressively enhancing your website, that's left up to the user as JMVC provides just a middle layer for development - it's up to you to make that design choice yourself.
However, JavaScriptMVC is simply the best general purpose JavaScriptMVC library because of its powerful event delegation based controllers.
Event delegation lets you escape having to attach event handlers, and simply create rules for your page.
Finally, JMVC is much more than a MVC architecture. It has all parts of the development cycle covered with:
Try kitty. It is only 1.4KB and its only dependency is EJS.
There was a key-value binding JavaScript framework called "Coherent", which was inspired by Apple's Cocoa Bindings. The framework has been bought by Apple, but there is still an old copy at http://github.com/trek/coherentjs/tree/master.