voltrb / volt

A Ruby web framework where your Ruby runs on both server and client
MIT License
3.22k stars 196 forks source link

bind visible inputs to change to allow 3rd party javascript libraries to update bindings #279

Closed alexandred closed 9 years ago

alexandred commented 9 years ago

3rd party libraries that trigger a change in a textarea or text input field with

$("textarea").val("attr");

do not trigger the event ''input" on the field hence the volt binding does not update. This fix allows for libraries that provide functionality such as autocompletion to update volt bindings.

This fix would probably require refactoring and as such is just a proof of functionality.

ryanstout commented 9 years ago

If we do this, are we getting two events for each keypress?

alexandred commented 9 years ago

Unfortunately two events do indeed fire for each keypress. One on the actual input and one when the field blurs. With my limited knowledge of javascript, I am not sure how to get around that problem. Could we use .watch as is done for the hidden input fields?

Edit: This issue seems to arise because of a bug in jQuery itself: http://bugs.jquery.com/ticket/14825 .

alexandred commented 9 years ago

While this is still an issue, I have closed this PR for the moment because of changes to the structure of my fork of volt.