let elem = document.getElementById('test'); document.onmousedown = function(ev) { return [].includes.call(ev.path, elem) };