JQuery-Free Rails and Legacy Browsers

Rails 5.1 will no longer depend on JQuery. I ran the UJS test suite on several versions of IE to see how nicely the new system plays with legacy browsers.

You may have heard that Rails 5.1 will no longer depend on JQuery. Here's the PR.

Now, you might be asking yourself: "Why would a Ruby framework have a dependency on JQuery in the first place?" The answer lies in in Rails' unobtrusive JavaScript system. That's the bit that makes it possible to do things like:

link_to "delete", delete_path, remote: true, method: destroy

In order to remove this dependency, the UJS system has been ported to vanilla JS. It's also been given a new gem name. Instead of requiring the jquery-ujs gem, we'll be requiring the rails-ujs gem.

Legacy Browser Support

The one major drawback to eliminating JQuery is that UJS will no longer support older browsers as well as it used to. One of the reasons for JQuery's size and complexity is that it does support legacy browsers.

This potential issue was hinted at in the original Github issue, but nobody specifically mentioned which browsers would be unsupported. That's why I thought it would be interesting to run some tests.

I ran the test suites for jquery-ujs 1.2 and the latest rails-ujs (Jan 5, 2017) on IE 8-11. Chrome (55.0.2883.95) was used as a control. Microsoft provides free VMs for testing, if you're playing along at home.

Browser jquery-ujs test failures rails-ujs test failures
Chrome 0 of 110 0 of 110
IE11 3 of 110 Tests won't run
IE10 4 of 110 119 of 122
IE9 4 of 110 119 of 122
IE8 14 of 110 118 of 122


Neither of the test suites worked perfectly in IE, but the jquery-ujs suite fared much better. The new Rails UJS system seems to be completely unsupported on IE10 and down. I was unable to get a good reading on IE11 as a the test suite refused to run.

Supposedly it will be possible to load the older jquery-ujs gem on top of the new rails-ujs to bring back legacy browser support. I haven't had a chance to see if it works yet.

Honeybadger has your back when it counts.

We combine error tracking, uptime monitoring, and cron & heartbeat monitoring into a simple, easy-to-use platform. Our mission: to tame production and make you a better, more productive developer.

Learn more
author photo

Starr Horne

Starr Horne is a Rubyist and Chief JavaScripter at Honeybadger.io. When she's not neck-deep in other people's bugs, she enjoys making furniture with traditional hand-tools, reading history and brewing beer in her garage in Seattle.

More articles by Starr Horne
“We've looked at a lot of error management systems. Honeybadger is head and shoulders above the rest and somehow gets better with every new release.” 
Michael Smith
Try Honeybadger Free for 15 Days