From dc2f1d6bd3a2f300065d2c73ea3bea36fb4cfbde Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 3 Jun 2019 08:30:24 -0400 Subject: [PATCH] Add global Javascript Element.matches polyfill --- view/js/main.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/view/js/main.js b/view/js/main.js index cd09de0143..a2e2698a82 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1,4 +1,21 @@ // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later + +// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill +if (!Element.prototype.matches) { + Element.prototype.matches = + Element.prototype.matchesSelector || + Element.prototype.mozMatchesSelector || + Element.prototype.msMatchesSelector || + Element.prototype.oMatchesSelector || + Element.prototype.webkitMatchesSelector || + function(s) { + var matches = (this.document || this.ownerDocument).querySelectorAll(s), + i = matches.length; + while (--i >= 0 && matches.item(i) !== this) {} + return i > -1; + }; +} + function resizeIframe(obj) { _resizeIframe(obj, 0); } -- 2.39.5