[openstreetmap/openstreetmap-website] Replace augment.js with a modern set of polyfills where needed (#2125)

Tom Hughes notifications at github.com
Wed Jan 30 18:25:51 UTC 2019


We've had `augment.js` in our vendor tree for some time now which provides polyfills for a number of ES5 methods but it looks pretty dead upstream.

Now we could quite possibly get away without it now - only really ancient browsers like IE8 are really affected as anything even vaguely modern has fairly complete ES5 support. As I discovered last night however (with `Array.prototype.findIndex`) people certainly notice is you rely on ES6 though even that is supported by most browsers (excluding all IEs obviously).

So what this does is to replace `augment.js` with a reasonably complete set of ES5 and ES6 polyfills (from `polyfill.io`) but it uses browser detection to avoid sending them to modern browsers.

Currently it assumes that WebKit/Firefox/Safari/Edge are OK which certainly seems to be the case for current versions and we can always tune it if it turns out that some older versions need help.
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/2125

-- Commit Summary --

  * Add browser detection framework
  * Replace conditional comments with browser detection
  * Replace augment.js with conditional polyfills for ES5 and ES6

-- File Changes --

    M Gemfile (3)
    M Gemfile.lock (2)
    M Vendorfile (5)
    M app/assets/javascripts/application.js (1)
    M app/views/layouts/_head.html.erb (8)
    M config/initializers/assets.rb (2)
    A config/initializers/browser.rb (19)
    D vendor/assets/augment.js/augment.js (444)
    A vendor/assets/polyfill/es5.js (1821)
    A vendor/assets/polyfill/es6.js (6658)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/2125.patch
https://github.com/openstreetmap/openstreetmap-website/pull/2125.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2125
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190130/1f861d94/attachment.html>


More information about the rails-dev mailing list