rye icon indicating copy to clipboard operation
rye copied to clipboard

bind()ing an event handler makes me lose access to the matched element

Open ricardobeat opened this issue 11 years ago • 1 comments

Let's say you have

one.on('click .two', function (e, el) {
    // e.target = can be a descendant
    // el == the delegate root
    // this == xxx
}.bind(xxx))

There is no way you can access the actual element (.two). jQuery exposes it as e.currentTarget (I think), along with e.delegateTarget. Should we manipulate the event object too, maybe also normalize e.keyCode/which while we're at it?

ricardobeat avatar Apr 01 '13 14:04 ricardobeat

Yes, it is across currentTarget.

jcemer avatar Apr 01 '13 15:04 jcemer