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

Conclusions

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.

What to do next:
  1. Try Honeybadger for FREE
    Honeybadger helps you find and fix errors before your users can even report them. Get set up in minutes and check monitoring off your to-do list.
    Start free trial
    Easy 5-minute setup — No credit card required
  2. Get the Honeybadger newsletter
    Each month we share news, best practices, and stories from the DevOps & monitoring community—exclusively for developers like you.
    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
    Stop wasting time manually checking logs for errors!

    Try the only application health monitoring tool that allows you to track application errors, uptime, and cron jobs in one simple platform.

    • Know when critical errors occur, and which customers are affected.
    • Respond instantly when your systems go down.
    • Improve the health of your systems over time.
    • Fix problems before your customers can report them!

    As developers ourselves, we hated wasting time tracking down errors—so we built the system we always wanted.

    Honeybadger tracks everything you need and nothing you don't, creating one simple solution to keep your application running and error free so you can do what you do best—release new code. Try it free and see for yourself.

    Start free trial
    Simple 5-minute setup — No credit card required

    Learn more

    "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, Cofounder & CTO of YvesBlue

    Honeybadger is trusted by top companies like: