Last active
October 13, 2020 02:59
-
-
Save peerreynders/57c52a13d1efa1311c6fc04b7603a23b to your computer and use it in GitHub Desktop.
Differential Serving
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window._log('ECMAScript 2015 - with classes but no modules'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window._log('ECMAScript 2017 - classes and modules'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| window._log('ECMAScript 5 - no classes, no modules'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html lang="eng"> | |
| <!-- | |
| "A Universal Bundle Loader" | |
| https://medium.com/@WebReflection/a-universal-bundle-loader-6d7f3e628f93 | |
| "Differential Serving" | |
| https://css-tricks.com/differential-serving/ | |
| --> | |
| <head> | |
| <meta charset="utf-8"/> | |
| <title>Differential Serving</title> | |
| </head> | |
| <body> | |
| <p>JavaScript didn't execute</p> | |
| <script> | |
| (function() { | |
| 'use strict'; | |
| var element = document.querySelector('p'); | |
| element.textContent = ''; | |
| window._log = function (text) { | |
| element.textContent += text; | |
| }; | |
| }()); | |
| </script> | |
| <script type="module"> | |
| window._ESM = !0; | |
| import './es2017.js'; | |
| </script> | |
| <script nomodule defer> | |
| (function(g, d, es2015, es5) { | |
| if(!g._ESM) { | |
| var h = d.documentElement; | |
| var s = d.createElement('script'); | |
| s.defer = !0; | |
| s.type = 'text/javascript'; | |
| s.src = g.Reflect ? es2015 : es5; | |
| h.insertBefore(s, h.lastChild); | |
| } | |
| }(window, document, './es2015.js', './es5.js')); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment