A little but of XUL, XForms, XMLEvents, XInclude and MVVM for the evergreen browsers (Chrome and Opera tested, WebKit). Just to keep up to date with latest technologies before I get too old.
No routing , iOC or things like that. Just pure MVVM Pattern explained with use of some custom html elements. iOC and routing can easily be added by pluging in other libraries.
Objects on the viewModel that are frozen (Object.freeze) will not be databound. Also works on Arrays, items in arrays etc....just freeze what needs to be frozen.
example
All attributes defined on the oig-binding element will be set on the bound element. Bindings are namespace aware. Meaning that Attr.namespaceURI and prefix will be preserved and setAttributeNS will be called on bound element.
Attribute bindings will be evaluated as javascript expressions.
oig-binding style="'color:' + color"
Manual two way binding can be done using oig-listeners. Normally changes occur in the view after a user interaction which means that listening to change is a good way to detect changes.
Binding elements are used to provide 'context' to the view. This means that a viewModel will be attached to a HTMLDivElement so that all it's children can use this viewModel for data binding
In the example below a basic viewModel is constructed by defining a new property on the oig.viewModels object
When a ViewModel is used in a View(Component) than it will be referred to as 'dataContext'
Only HTMLDivElements can be used for contextelement.
HTMLDivElements are 'sections' so it's a semantic choice to allow DIV only