2 ms·
But that crashes on null in all three languages, no? (i.e. if evt is null and window.event is non-null.) I suppose you could do this: function getEventTarget
by gruseom 16y ago
But that crashes on null in all three languages, no? (i.e. if evt is null and window.event is non-null.) I suppose you could do this:
function getEventTarget(evt) {
return (evt || (evt = window.event)) && (evt.target || evt.srcElement);
}
But that's probably more trouble than it's worth. Anyway, I agree with you in preferring expressions to statements on the whole. It's hard to imagine why anyone would prefer the more than 4x as long version in the OP; to me it reads like a parody.