Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

currentTarget for delegated events #11

Closed
STRd6 opened this issue Jan 21, 2013 · 3 comments
Closed

currentTarget for delegated events #11

STRd6 opened this issue Jan 21, 2013 · 3 comments

Comments

@STRd6
Copy link

STRd6 commented Jan 21, 2013

Is there a way to get currentTarget to work correctly with delegated events or am I doing something wrong?

$(".itemPalette").on "movestart", ".item", (e) ->
  $(e.currentTarget) # is document rather than .item
@stephband
Copy link
Owner

Ooo, it shouldn't do that. I don't know if it's wrong because I'm not
familiar with CoffeScript, but I haven't run into this problem. Is it
happening on move and moveend as well as movestart?

On 21 January 2013 21:03, Daniel X Moore notifications@github.com wrote:

Is there a way to get currentTarget to work correctly with delegated
events or am I doing something wrong?

$(".itemPalette").on "movestart", ".item", (e) ->
$(e.currentTarget) # is document rather than .item


Reply to this email directly or view it on GitHubhttps://github.com//issues/11.

@stephband
Copy link
Owner

Furthermore, why is it document, and not .itemPalette ?

On 21 January 2013 21:06, Stephen Band stephband@googlemail.com wrote:

Ooo, it shouldn't do that. I don't know if it's wrong because I'm not
familiar with CoffeScript, but I haven't run into this problem. Is it
happening on move and moveend as well as movestart?

On 21 January 2013 21:03, Daniel X Moore notifications@github.com wrote:

Is there a way to get currentTarget to work correctly with delegated
events or am I doing something wrong?

$(".itemPalette").on "movestart", ".item", (e) ->
$(e.currentTarget) # is document rather than .item


Reply to this email directly or view it on GitHubhttps://github.com//issues/11.

@STRd6
Copy link
Author

STRd6 commented Jan 21, 2013

Actually I think it may have been an error in my usage. I was migrating some code from a global draggable where some events were bound on document and some were delegated. Upon further inspection it seems to be working correctly.

Thanks for the quick response!

@STRd6 STRd6 closed this as completed Jan 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants