A minimal polyfill for Element.closest()
and Element.matches()
, using MDN's implementation. Mostly meant for Microsoft IE9+.
$ npm install --save element-closest-polyfill
Pick your favorite:
require("element-closest-polyfill");
import 'element-closest-polyfill';