summaryrefslogtreecommitdiffstats
path: root/web_src/js/polyfills.js
diff options
context:
space:
mode:
Diffstat (limited to 'web_src/js/polyfills.js')
-rw-r--r--web_src/js/polyfills.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/web_src/js/polyfills.js b/web_src/js/polyfills.js
new file mode 100644
index 0000000000..0063b6d253
--- /dev/null
+++ b/web_src/js/polyfills.js
@@ -0,0 +1,17 @@
+// compat: IE11
+if (!Element.prototype.matches) {
+ Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
+}
+
+// compat: IE11
+if (!Element.prototype.closest) {
+ Element.prototype.closest = function (s) {
+ let el = this;
+
+ do {
+ if (el.matches(s)) return el;
+ el = el.parentElement || el.parentNode;
+ } while (el !== null && el.nodeType === 1);
+ return null;
+ };
+}