<p>We've had <code>augment.js</code> in our vendor tree for some time now which provides polyfills for a number of ES5 methods but it looks pretty dead upstream.</p>
<p>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 <code>Array.prototype.findIndex</code>) people certainly notice is you rely on ES6 though even that is supported by most browsers (excluding all IEs obviously).</p>
<p>So what this does is to replace <code>augment.js</code> with a reasonably complete set of ES5 and ES6 polyfills (from <code>polyfill.io</code>) but it uses browser detection to avoid sending them to modern browsers.</p>
<p>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.</p>
<hr>
<h4>You can view, comment on, or merge this pull request online at:</h4>
<p> <a href='https://github.com/openstreetmap/openstreetmap-website/pull/2125'>https://github.com/openstreetmap/openstreetmap-website/pull/2125</a></p>
<h4>Commit Summary</h4>
<ul>
<li>Add browser detection framework</li>
<li>Replace conditional comments with browser detection</li>
<li>Replace augment.js with conditional polyfills for ES5 and ES6</li>
</ul>
<h4>File Changes</h4>
<ul>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2125/files#diff-0">Gemfile</a>
(3)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2125/files#diff-1">Gemfile.lock</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2125/files#diff-2">Vendorfile</a>
(5)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2125/files#diff-3">app/assets/javascripts/application.js</a>
(1)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2125/files#diff-4">app/views/layouts/_head.html.erb</a>
(8)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2125/files#diff-5">config/initializers/assets.rb</a>
(2)
</li>
<li>
<strong>A</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2125/files#diff-6">config/initializers/browser.rb</a>
(19)
</li>
<li>
<strong>D</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2125/files#diff-7">vendor/assets/augment.js/augment.js</a>
(444)
</li>
<li>
<strong>A</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2125/files#diff-8">vendor/assets/polyfill/es5.js</a>
(1821)
</li>
<li>
<strong>A</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2125/files#diff-9">vendor/assets/polyfill/es6.js</a>
(6658)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/2125.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/2125.patch</a></li>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/2125.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/2125.diff</a></li>
</ul>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/2125">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABWnLTrU3EDdsJIYObmsrTOkVSljMAgtks5vIeOvgaJpZM4aayuE">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABWnLTswb8krr6OLm0P7nG8KUIpkAUISks5vIeOvgaJpZM4aayuE.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/openstreetmap/openstreetmap-website","title":"openstreetmap/openstreetmap-website","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/openstreetmap/openstreetmap-website"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Replace augment.js with a modern set of polyfills where needed (#2125)"}],"action":{"name":"View Pull Request","url":"https://github.com/openstreetmap/openstreetmap-website/pull/2125"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/2125",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/2125",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>