With this HTML
<div>
<button>
<img src="https://img.skitch.com/20110912-1m2qj31m7sxmh46uheef63gutu.gif">
</button>
</div>
and this jQuery
$(document).ready(function() {
$("body").live("click", function(event) {
$("body").append(event.target.tagName);
});
});
Why is the event target node in Chrome the image and in Firefox it's the button?
jsfiddle test -> http://jsfiddle.net/MikeGrace/YC5A7/
This isn't limited to images, of course -- I tweaked your code at http://jsfiddle.net/YC5A7/13/ and got the same result with an ordinary hyperlink.
According to the jQuery docs, event.target "can be the element that registered for the event or a descendant of it." So your results are consistent with the intended purpose of that method.
However, event.currentTarget has the desired result in all browsers: http://jsfiddle.net/YC5A7/16/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With