gmac / backbone.epoxy

Declarative data binding and computed models for Backbone
http://epoxyjs.org
MIT License
615 stars 89 forks source link

No error when bindingHandler does not exist #17

Closed dspangen closed 11 years ago

dspangen commented 11 years ago

If you reference a handler that doesn't exist in a data-bind, the binding fails silently. Similarly to the recent bug filed about no failures when a binding doesn't exist, I feel this should also be an error.

gmac commented 11 years ago

Very fair assessment; although I do think that was in there once and I decided to take it out. I'll consider that while locking down the v1.0 release. In the meantime, feel free to hang an else statement with an error off line #1213.

gmac commented 11 years ago

I tried adding this in, and then immediately remembered why it had been removed... there are circumstances where we may want to include extra meta data within bindings that are not actually binding handlers themselves. The most common example of this is the events binding, which simply defines an array of DOM event names. Other examples within Epoxy core are optionsDefault and optionsEmpty. You could also set up custom bindings to read additional data from the binding string, therefore it can't be assumed that an unknown binding field is automatically wrong.

I do agree that it would be nice for the library to alert you of mistakes (that are probably typos). However, the overall design of the library gets handcuffed if we start treating every unknown as an error. I guess I'm going to have to defer this as a "wontfix" in the best interest of the library's flexibility.