selectorMatches function(el, selector) {
var p = Element.prototype;
var f = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector || function(s) {
return [].indexOf.call(document.querySelectorAll(s), this) !== -1;
};
return f.call(el, selector);
}
return [].indexOf.call(document.querySelectorAll(s), this) !== -1;
will bereturn document.querySelectorAll(s).IndexOf(this) !== -1;
return f.call(element, selector);
?[].indexOf.call(document.querySelectorAll(s), this)
document.querySelectorAll(s).indexOf(this)
Array.from(document.querySelectorAll(s)).indexOf(this)
Find more questions by tags JavaScript