rangetouch
Version:
A super tiny library to make input type='range' sliders work better on touch devices
20 lines (15 loc) • 480 B
JavaScript
// Element matches a selector
export function matches(element, selector) {
const prototype = { Element };
function match() {
return Array.from(document.querySelectorAll(selector)).includes(this);
}
const method =
prototype.matches ||
prototype.webkitMatchesSelector ||
prototype.mozMatchesSelector ||
prototype.msMatchesSelector ||
match;
return method.call(element, selector);
}
export default { matches };