mikeric / rivets

Lightweight and powerful data binding.
http://rivetsjs.com
MIT License
3.23k stars 309 forks source link

jquery events vs. js/dom events #705

Open erdalkaraca opened 7 years ago

erdalkaraca commented 7 years ago

I have a custom binder that uses jquery on(...) events binding. The binder works as expected in Opera but fails in other browsers. First, I thought this might be a browser caching problem. but then I debugged the rivets sources to observe that rivets checks whether jquery is available or not and hence decides for either jquery events or js/dom events.

To make it short: I had to make sure that jquery was loaded before rivetsjs (via RequireJS). Is this a known issue? Is there a hint to be aware of this scenario?

benadamstyles commented 7 years ago

Which version of rivets are you using?

erdalkaraca commented 7 years ago

I am at 0.9.3

benadamstyles commented 7 years ago

Could you try updating to 0.9.6 and see if it fixes your issue? 0.9.5 added a fix regarding jQuery usage.

erdalkaraca commented 7 years ago

With 9.6.3 I get this error in the console: Uncaught TypeError: jQuery is not a function at Binding.routine (rivets.js:1026) at Binding.Rivets.Binding.Binding.set (rivets.js:653) at Binding.set (rivets.js:7) at Binding.Rivets.Binding.Binding.sync (rivets.js:658) at Binding.sync (rivets.js:7) at Binding.Rivets.Binding.Binding.bind (rivets.js:719) at Binding.bind (rivets.js:7) at View.Rivets.View.View.bind (rivets.js:478) at View.bind (rivets.js:7) at Object.bind (rivets.js:58)

Now, I have to make sure jquery is loaded before rivets in any case.

Namek commented 7 years ago

@erdalkaraca AFAIR I have encountered similiar problem, may the 0.9.6 fix that with https://github.com/mikeric/rivets/commit/a33ce65f6199cc5edc97e1247c0a4ca789fb3829?