gmac / backbone.epoxy

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

Allow binding custom events to non-form elements #73

Open maxpoulin64 opened 10 years ago

maxpoulin64 commented 10 years ago

Some UI libraries (like jQuery UI) relies on DOM events to dispatch updates events. An example would be the jQuery UI sliders, which triggers a "slide" event on its containing

element when the slider changes position and should update the value.

Epoxy previously refused to bind events to non form elements like divs so it was impossible to create bindingHandlers using those events. set() was working correctly but get() was never ever called because the events were never bound due to changable being false. I fixed it so when a user manually passes events, they are bound regardless of if it's a form element or not. Passing events on the DOM for custom widgets is not uncommon so I thought I should share the modification =]

(Note: this is my first pull request ever, please excuse my mistakes if any!)

gmac commented 10 years ago

Cool, thanks. Out of the country at the moment, I'll try to review in the coming weeks and give the pass/fail/cleanup.

OneGeek commented 10 years ago

I ran into this issue yesterday, ended up modifying my local copy of epoxy.js, but would like to see this fix merged and deployed to bower if possible.