then use this.clickHandler.bindWithEvent(this, $(element).get('id'));
and modify the clickHandler signature to function(event, id)
you can get at the original element with $(id).
you would just want to not pass in the element to the bind, or you
might as well have just done an inner function, pass the id through
and you can safely retrieve the element you need.
if it doesn't have an id, give it one: $(element).set('id', 'element_'
+ $(element).uid);
it would also be feasible to create a custom binding solution for
these type situations (maybe i'll do that). :)
On May 4, 11:55 am, Tim Wienk <[email protected]> wrote:
> Izzy,
>
> Using event.target may not work as intended when clicking child
> elements of the element you attached the event
> to:http://jsfiddle.net/timwienk/hNMm4/
>
> In the event handler `this` refers to the element the event fired on.
> event.target is the element that was the event's target.
>
> (Sometimes this actually *is* the intended effect, and it's actually
> the basis of how delegation works. Attach an event to a parent
> element, but only do stuff when `event.target.match(yourSelector)`).