summaryrefslogtreecommitdiff
path: root/assets/js/polyfills/matches.js
blob: a6f813bfb5e13ec5ef7acf57a4804887933c3f89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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;
        };
}