UNPKG

611 BJavaScriptView Raw
1"use strict";
2
3exports.__esModule = true;
4exports.default = matches;
5var matchesImpl;
6/**
7 * Checks if a given element matches a selector.
8 *
9 * @param node the element
10 * @param selector the selector
11 */
12
13function matches(node, selector) {
14 if (!matchesImpl) {
15 var body = document.body;
16 var nativeMatch = body.matches || body.matchesSelector || body.webkitMatchesSelector || body.mozMatchesSelector || body.msMatchesSelector;
17
18 matchesImpl = function matchesImpl(n, s) {
19 return nativeMatch.call(n, s);
20 };
21 }
22
23 return matchesImpl(node, selector);
24}
25
26module.exports = exports["default"];
\No newline at end of file