Skip to content

Commit 712c40e

Browse files
authored
refactor: removed polyfill out of codebase (#1398)
* refactor: integrated polyfill as a dependency * refactor: .matches polyfill is even already included in .closest polyfill * refactor: reverted yarn.lock as there weren't any relevant changes out of this pull requests code changes
1 parent f0e29e9 commit 712c40e

File tree

3 files changed

+3
-19
lines changed

3 files changed

+3
-19
lines changed

packages/uikit-polyfills/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import 'get-own-property-symbols';
44
import '@webcomponents/webcomponentsjs/webcomponents-bundle';
55

66
import 'element-closest';
7+
// A matches polyfill is already included in the previous closest polyfill – as long as that one is still included, we won't need the next one
8+
// import 'element-matches';
79
import 'core-js/modules/es.string.includes';
810
import 'core-js/modules/es.string.trim-end';
911
import 'core-js/modules/es.string.trim-start';

packages/uikit-polyfills/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@pattern-lab/uikit-polyfills",
33
"version": "5.15.5",
4-
"description": "Web Component Polyfills used in Pattern Lab's UIKit",
4+
"description": "Web Component and further necessary Polyfills used in Pattern Lab's UIKit",
55
"main": "index.js",
66
"author": "Salem Ghoweri <me@salemghoweri.com>",
77
"license": "MIT",

packages/uikit-workshop/src/scripts/components/pl-nav/get-parents.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,4 @@
11
export const getParents = (elem, selector) => {
2-
// Element.matches() polyfill
3-
if (!Element.prototype.matches) {
4-
Element.prototype.matches =
5-
Element.prototype.matchesSelector ||
6-
Element.prototype.mozMatchesSelector ||
7-
Element.prototype.msMatchesSelector ||
8-
Element.prototype.oMatchesSelector ||
9-
Element.prototype.webkitMatchesSelector ||
10-
function (s) {
11-
const matches = (this.document || this.ownerDocument).querySelectorAll(
12-
s
13-
),
14-
i = matches.length;
15-
while (--i >= 0 && matches.item(i) !== this) {}
16-
return i > -1;
17-
};
18-
}
19-
202
// Set up a parent array
213
const parents = [];
224

0 commit comments

Comments
 (0)