Управление DOM с помощью JavaScript в современных браузерах и IE 11+
// Return true if `ele` matches the CSS selector `selector`
const matches = function(ele, selector) {
return (
ele.matches ||
ele.matchesSelector ||
ele.msMatchesSelector ||
ele.mozMatchesSelector ||
ele.webkitMatchesSelector ||
ele.oMatchesSelector
).call(ele, selector);
};