Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function handleEvent(e){
var evt, target, match;
evt = e ? e : window.event;
// target = (evt.currentTarget) ? evt.currentTarget : (evt.srcElement || evt.target);
match = Sizzle.matches(selector, [evt.target]);
// https://github.com/jquery/sizzle/wiki
if (match.length) {
if ('click' === action && 'A' === evt.target.nodeName) {
return handleClickEvent(evt, evt.target, callback);
}
else if ('submit' === action && 'FORM' === evt.target.nodeName) {
return handleFormSubmit(evt, evt.target, callback);
}
else {
callback(evt);
}
}
else if ('window' === selector) {
return clsRe && tagRe;
}
} else if (id && !tag && !cls) {
filter = function(elem) {
return elem.id === id;
};
}
}
if (S.isFunction(filter)) {
ret = S.filter(elems, filter);
}
// 其它复杂 filter, 采用外部选择器
else if (filter && sizzle) {
ret = sizzle.matches(filter, elems);
}
// filter 为空或不支持的 selector
else {
error(filter);
}
return ret;
},