What's a jQuery like and/or best practices way of getting the original target of an event in jQuery (or in browser javascript in general).
I've been using something like this
$('body').bind('click', function(e){
//depending on the browser, either srcElement or
//originalTarget will be populated with the first
//element that intercepted the click before it bubbled up
var originalElement = e.srcElement;
if(!originalElement){originalElement=e.originalTarget;}
});
which works, but I'm not pleased with the two line feature sniffing. Is there a better way?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…