Skip to content

Commit

Permalink
refactor: Drop Edge old versions (<14) support
Browse files Browse the repository at this point in the history
Description:

Remove the medium version of the polyfill for ESL UI site renderer
Drop support for Edge old versions and ES6 polyfils

BREAKING CHANGES:

ESL UI site renderer and ESL polyfills no longer support Edge old versions and ES6 polyfils.
  • Loading branch information
HenadzV authored and ala-n committed Mar 17, 2023
1 parent 6d376ee commit b577fd1
Show file tree
Hide file tree
Showing 13 changed files with 9 additions and 172 deletions.
15 changes: 7 additions & 8 deletions docs/BROWSER_SUPPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
Exadel Smart Library does not have dependencies but uses the following list of native browser features:

- ECMAScript 6 features
- [Array.from](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from) (no Iterable Objects support required)
- [Array.prototype.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
- [Array.prototype.findIndex](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex)
- [Array.prototype.include](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes)
- [Object.is](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is)
- [Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) (accurate polyfill required)
- [ES6 Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
- Web API
- [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event) constructor + `preventDefault` polyfill
Expand All @@ -20,13 +26,6 @@ Exadel Smart Library does not have dependencies but uses the following list of n

All of them are fully supported by modern browsers such as Chrome, Firefox, Safari or Edge (>43).

In order to make ESL work in older browsers, you can use a "light" polyfills list of IntersectionObserver, ResizeObserver and Custom Elements (for older versions of Edge and Safari).
In order to make ESL work in older browsers, you can use a "light" polyfills list (for older versions Safari).

See more details on what polyfill approach might look like in the demo pages source code.

Also, ESL has built-in polyfills for some of DOM and ES6 features. They are available under [polyfills](../src/polyfills) directory:
- ECMA Script 5: output shim (`HTMLElement` constructor call) - [es5-target-shim.ts](../src/polyfills/es5-target-shim.ts)
- ECMA Script 6: DOM - [polyfills.es6.ts](../src/polyfills/polyfills.es6.ts)
- `Node.isConnected`
- `KeyboardKey.prototype.key`
- `Element.prototype.toggleAttribute`
26 changes: 0 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
"@types/smoothscroll-polyfill": "^0.3.1",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"@webcomponents/custom-elements": "1.5.1",
"chokidar-cli": "^3.0.0",
"clean-css-cli": "^5.6.2",
"concurrently": "^7.6.0",
Expand All @@ -110,7 +109,6 @@
"foreach-cli": "^1.8.1",
"html-minifier": "^4.0.0",
"husky": "^8.0.3",
"intersection-observer": "^0.12.2",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"js-yaml": "^4.1.0",
Expand Down
2 changes: 0 additions & 2 deletions pages/src/localdev.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Support for ES5 bundle target
import '../../src/polyfills/es5-target-shim';
// Builtin polyfills
import '../../src/polyfills/polyfills.es6';
// Validate environment
import '../../src/polyfills/polyfills.validate';

Expand Down
7 changes: 1 addition & 6 deletions pages/src/polyfill-light.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/**
* Target: Edge, Safari 9
*/
import '../../src/polyfills/polyfills.es6';

// IE, Safari <13.3
// Safari <13.3
import {ResizeObserver} from '@juggle/resize-observer';
window.ResizeObserver = window.ResizeObserver || ResizeObserver;

Expand Down
10 changes: 0 additions & 10 deletions pages/src/polyfill-medium.ts

This file was deleted.

4 changes: 1 addition & 3 deletions pages/views/_includes/polyfill.njk
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<script>
(function () {
var version = '';
if (!('getRootNode' in Element.prototype) || !window.customElements) {
version = 'medium';
} else if (!window.scrollBy || !window.IntersectionObserver || !window.ResizeObserver || !window.ResizeObserver) {
if (!window.scrollBy || !window.ResizeObserver) {
version = 'light';
}
(version) && document.write('<script type="text/javascript" src="{{ '/bundles/polyfill-' | url }}' + version + '.js"><\/script>');
Expand Down
1 change: 0 additions & 1 deletion pages/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module.exports = {
devtool: 'source-map',
entry: {
'localdev': './src/localdev.ts',
'polyfill-medium': './src/polyfill-medium.ts',
'polyfill-light': './src/polyfill-light.ts'
},
resolve: {
Expand Down
16 changes: 0 additions & 16 deletions src/polyfills/list/dom.element.toggleAttribute.ts

This file was deleted.

43 changes: 0 additions & 43 deletions src/polyfills/list/dom.event.keyboard.ts

This file was deleted.

38 changes: 0 additions & 38 deletions src/polyfills/list/dom.keyboard.key.ts

This file was deleted.

14 changes: 0 additions & 14 deletions src/polyfills/list/dom.node.isConnected.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/polyfills/polyfills.es6.ts

This file was deleted.

0 comments on commit b577fd1

Please sign in to comment.