Maybe I'm wrong, but can't you use event delegation here?
(function(){
$('#test').on('click', function(e){
if ( !/img$/i.test((e.target || e.eventSrc).nodeName)){
alert('row clicked');
} else {
alert('image clicked');
}
});
$('td.row').html('
');
})();
It saves you the hassle with propagation. Here's a jsfiddle