2 * Polyfills for DOM API's
5 if (!Element.prototype.matches) {
6 Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
9 if (!Element.prototype.closest) {
10 Element.prototype.closest = function (s) {
13 if (!document.documentElement.contains(el)) return null;
15 if (ancestor.matches(s)) return ancestor;
16 ancestor = ancestor.parentElement;
17 } while (ancestor !== null);