kobotoolbox / enketo-express

We've moved! Please use the new repository 🠊 https://github.com/enketo/enketo-express
Apache License 2.0
102 stars 90 forks source link

Provide IE11 polyfills through https://cdn.polyfill.io/ ? #1054

Closed MartijnR closed 6 years ago

MartijnR commented 6 years ago

If this works for offline-capable views, I think we'll have less performance degradation in modern browsers (due to IE11 support).

MartijnR commented 6 years ago

in that case, make sure to resolve 'enketo/polyfills-ie11' to false.

MartijnR commented 6 years ago
MartijnR commented 6 years ago
MartijnR commented 6 years ago

This can be made to work (at least online) but need to figure out explicit features to request (better too many than too few)

Update: https://cdn.polyfill.io/v2/polyfill.js?features=es2015,es2016,es2017,es2018,Element.prototype.matches) (not sure why Element.prototype.matches is not added automatically)

MartijnR commented 6 years ago

Doesn't seem to work with query params in manifest. Another way of approaching this is to add a script download to build script, and then serve this locally as a separate file with nomodule. That also fixes the manifest entry.

with explicit ie11 user agent:

https://cdn.polyfill.io/v2/polyfill.js?ua=ie%2F11.0.0&features=es2015%2Ces2016%2Ces2017%2Ces2018%2CElement.prototype.matches

The downside is that this file will be added to manifest for other browsers as well and is confirmed to be downloaded in Chrome offline-capable views (not in FF it appears).

Edge (17) downloads the script in online-only views despite the nomodule attribute. This is odd, but not a big deal since it's such an unpopular browser (worth the performance increase on Chrome and FF due to a much smaller JS file!)

MartijnR commented 6 years ago

This is done for KoBo. Must not forget to (to avoid loading IE11 polyfills twice):