You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
441 B

  1. // compat: IE11
  2. if (!Element.prototype.matches) {
  3. Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
  4. }
  5. // compat: IE11
  6. if (!Element.prototype.closest) {
  7. Element.prototype.closest = function (s) {
  8. let el = this;
  9. do {
  10. if (el.matches(s)) return el;
  11. el = el.parentElement || el.parentNode;
  12. } while (el !== null && el.nodeType === 1);
  13. return null;
  14. };
  15. }