├── README.md ├── bundle.js ├── index.html ├── modern.js └── module.js /README.md: -------------------------------------------------------------------------------- 1 | # ecma 2 | The simplest way to load ES modules or bundled fallbacks 3 | 4 | - - - 5 | 6 | ## How to 7 | 8 | Just put on top of your HTML page (even before polyfills) the script 9 | tag with the following attributes: 10 | 11 | * **data-module** the ES2015 module entry 12 | * **data-src** the ES3/5 fallback 13 | 14 | All browsers that are not implementing `nomodule` on script tags 15 | will be forced to use the fallback. 16 | 17 | ```html 18 | 30 | ``` 31 | 32 | As easy as that. 33 | 34 | 35 | ### Compatibility 36 | 37 | IE6 and above. [Live test](https://webreflection.github.io/ecma/) (it shows after one second on purpose) 38 | 39 | ### ES6 / ES2015 Browsers 40 | 41 | A list of browsers that will use native modules, hence fully compatible with ES2015 syntax. 42 | 43 | This list destiny it to keep growing over time. 44 | Meanwhile, the bundled fallback will still work as it's already the case today. 45 | 46 | **Desktop** 47 | 48 | * WebKit (GNOME Web, WebKitGTK+) 49 | * Chrome / Chromium 50 | 51 | **Mobile** 52 | 53 | No browser as of today ships with ES2015 modules support. 54 | 55 | 56 | #### [WTFPL License](https://en.wikipedia.org/wiki/WTFPL) 57 | -------------------------------------------------------------------------------- /bundle.js: -------------------------------------------------------------------------------- 1 | window.WAS_AFTER = window.AFTER; 2 | 3 | setTimeout(function () { 4 | document.documentElement.className = window.WAS_AFTER ? 'ok' : 'error'; 5 | document.body.innerHTML = 'ES5'; 6 | }, 1000); -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |