leonidas/transparency — Issue #24: easier binding for input elements
Author: dannyc
Created: 2012-02-29 09:39:10+00:00
State: open

Binding input values forces you to use a directives for every input element. For example:

directives = {
'name@value': function(element) { return this.name;},
'job@value': function(element) { return this.job; }
};

Alternatively I was able to create a single directive for all input elements like so:

'input@value': function(element) { return this[element.className];}
Which works but only if the input has a single class, otherwise returns undefined. Also since it catches all inputs if you have an input which you don't want bound that will automatically receive the undefined as well.
Perhaps you can add to the parser that if it's an input element instead of changing the element's text, change the value?

Thanks.