require-polyfills
Version:
Collection of polyfils that load automatically using require-bundle-js by detecting what is missing in the browser.
23 lines (22 loc) • 813 B
JavaScript
/**
* Extend browser support for Element.matches all the way back to IE9.
*
* Author: MDN
* https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
*/
(function () {
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;
};
}
})();