[11.2.x] fix(docs-infra): fix angular.io on IE 11#41184
Closed
gkalpak wants to merge 2 commits into
Closed
Conversation
…angular#41162) The custom elements spec is not compatible with ES5 style classes. This means ES2015 code compiled to ES5 will not work with a native implementation of Custom Elements. To support browsers that natively support Custom Elements but not ES2015 modules, we load `@webcomponents/custom-elements/src/native-shim.js`, which minimally augments the native implementation to be compatible with ES5 code. (See [here][1] for more details.) Previously, the shim was included in `polyfills.ts`, which meant it was loaded in all browsers (even those supporting ES2015 modules and thus not needing the shim). This commit moves the shim from `polyfills.ts` to a `nomodule` script tag in `index.html`. This will ensure that it is only loaded in browsers that do not support ES2015 modules and thus do not needed the shim. NOTE: This commit also reduces size of the polyfills bundle by ~400B (52609B --> 52215B). [1]: https://www.npmjs.com/package/@webcomponents/custom-elements#es5-vs-es2015 PR Close angular#41162
Previously, the angular.io app was broken on IE 11. In particular, pages that included Custom Elements would fail to load, because the `Reflect.construct()` method (which the Custom Elements ES5 shim relies on) was not available. This commit fixes this by loading the polyfill for `Reflect.construct()` on browsers that do not support ES2015 (including IE 11). PR Close angular#41162
|
You can preview 51ecd79 at https://pr41184-51ecd79.ngbuilds.io/. |
Contributor
|
Closed by commit 74aba13 |
AndrewKushnir
pushed a commit
that referenced
this pull request
Mar 11, 2021
…#41162) (#41184) The custom elements spec is not compatible with ES5 style classes. This means ES2015 code compiled to ES5 will not work with a native implementation of Custom Elements. To support browsers that natively support Custom Elements but not ES2015 modules, we load `@webcomponents/custom-elements/src/native-shim.js`, which minimally augments the native implementation to be compatible with ES5 code. (See [here][1] for more details.) Previously, the shim was included in `polyfills.ts`, which meant it was loaded in all browsers (even those supporting ES2015 modules and thus not needing the shim). This commit moves the shim from `polyfills.ts` to a `nomodule` script tag in `index.html`. This will ensure that it is only loaded in browsers that do not support ES2015 modules and thus do not needed the shim. NOTE: This commit also reduces size of the polyfills bundle by ~400B (52609B --> 52215B). [1]: https://www.npmjs.com/package/@webcomponents/custom-elements#es5-vs-es2015 PR Close #41162 PR Close #41184
AndrewKushnir
pushed a commit
that referenced
this pull request
Mar 11, 2021
Previously, the angular.io app was broken on IE 11. In particular, pages that included Custom Elements would fail to load, because the `Reflect.construct()` method (which the Custom Elements ES5 shim relies on) was not available. This commit fixes this by loading the polyfill for `Reflect.construct()` on browsers that do not support ES2015 (including IE 11). PR Close #41162 PR Close #41184
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a backport of #41162 to the
11.2.xbranch.fix(docs-infra): avoid unnecessarily loading Custom Elements ES5 shim:
The custom elements spec is not compatible with ES5 style classes. This means ES2015 code compiled to ES5 will not work with a native implementation of Custom Elements. To support browsers that natively support Custom Elements but not ES2015 modules, we load
@webcomponents/custom-elements/src/native-shim.js, which minimally augments the native implementation to be compatible with ES5 code.(See here for more details.)
Previously, the shim was included in
polyfills.ts, which meant it was loaded in all browsers (even those supporting ES2015 modules and thus not needing the shim).This commit moves the shim from
polyfills.tsto anomodulescript tag inindex.html. This will ensure that it is only loaded in browsers that do not support ES2015 modules and thus do not needed the shim.NOTE:
This commit also reduces size of the polyfills bundle by ~400B (52609B --> 52215B).
fix(docs-infra): fix angular.io on IE 11:
Previously, the angular.io app was broken on IE 11. In particular, pages that included Custom Elements would fail to load, because the
Reflect.construct()method (which the Custom Elements ES5 shim relies on) was not available.This commit fixes this by loading the polyfill for
Reflect.construct()on browsers that do not support ES2015 (including IE 11).