This blog is part of our Rails 5.1 series.
The jquery-rails gem contains the jquery-ujs driver which provides all the nice unobtrusive features.
The current jquery-based approach would still be available. It's just that it's not part of the default stack. You will need to manually add the jquery-rails gem to newly created 5.1 application and update the application.js to include the jquery-ujs driver.
It's worth noting that rails-ujs only supports IE 11+. Visit the Desktop Browser Support section of Basecamp to see the full list of all the supported browsers.
Browsers support without jQuery
We saw some discussion about which all browsers are supported without jQuery. We decided to test it ourselves on a plain vanilla CRUD Rails app. We tested "adding", "editing" and "deleting" of a resource.
We found that all three operations (adding, editing and deleting) to be working in following cases.
- Win 7 - IE 9
- Win 7 - IE 10
- Win 7 - IE 11
- Win 8 - IE 10
- Win 8.1 - IE 11
- Win 10 - IE 14 Edge
- Win 10 - IE 15 Edge
- Win 10 - Firefox 53
- Win 10 - Chrome 58
- Win 10 - Safari 5.1
- Mac Sierra - Safari 10.1
- Mac Sierra - Firefox 53
- Mac Sierra - Chrome 58
API change for the event handlers
rails-ujs driver has changed the signature of the event handler functions to just pass one event object instead of event, data, status and xhr as in the case of jquery-ujs driver.
Check the documentation for the rails-ujs event handlers for more details.