I came across a situation where having single handler helps simplify the project. Does this have any impact on performance? Especially when the mouse move event called, having too many conditions have any impact on performance?
var myHandler = function(e){
if (e.type == 'mousemove'){
} else if (e.type == 'mouseover'){
} else if (e.type == 'mouseout'){
} else if (e.type == 'mousedown'){
} else if (e.type == 'mouseup'){
}
};
$('#Element').bind('mouseover mouseout mousedown mouseup mousemove', myHandler);
If you do need to handle all those events and you order the if-else statements by the frequency that the events are fired (as you already have) there is insignificant performance penalty, i.e. at most 4 short string comparisons. The following code tries to benchmark the performance of 10,000,000 string comparisons of fixed size:
Since the browser is not the only application on my PC the results vary between the executions, however, I very rarely got results of under 100ms in Chrome (remember that this is for 10,000,000 iterations).
Anyway, while your performance will not suffer from binding multiple events to a single function I really doubt that this will simplify your project. Having many if-else statements is usually considered a bad practice and a design flaw.
If you do this so that you can share state between the handlers by having them under the common scope of a function, you are better off having something like: