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

events are now always delegated (without any extra overhead) #5

Open
wants to merge 1 commit into
base: event-target
Choose a base branch
from
Open

events are now always delegated (without any extra overhead) #5

wants to merge 1 commit into from

Conversation

wkornewald
Copy link

This code also fixes a few bugs in the pinch event handling code. Please try the use-delegation.html page. It now works as expected (the same as with native touch events) and it's as efficient as the useDelegation=false code.

@fisherwebdev
Copy link
Member

Hi Waldemar,

I'm still looking into the ramifications of this change, but I hope to pull it into master within a day or two.

thanks again for being awesome,
Bill

@fisherwebdev
Copy link
Member

Hi Waldemar,

I'm very sorry, but I can't pull this into master as it stands right now. However, I'm hopeful we can figure out a way to pull in your technique in a different way.

The issue is being able to stop the event propagation ("bubbling up") if the developer wants to do so. I've created a test page on the event-target branch called donut.html to demonstrate the possible use case. The developer might want different handling of events on nested elements, and unfortunately, this is impossible with the technique you have proposed. (Please see Ben Alman's article, section 4.2 and section 4.3 about this issue -- however, he accidentally says event.preventDefault and he should have said event.stopPropagation.)

Perhaps there is a way for us to put your technique behind a settings parameter, somewhat like the original useDelegation setting? I would imagine that this would not replace useDelegation but would instead be exposed as a completely new settings parameter.

Also, if you do decide to revise this and submit a new pull request (which would be really, really great) please adhere to just a couple of conventions that are in the Touchy code now:

  1. Please do not delete the comments showing the exploded example of the meta-programming loop.
  2. Please prepend a dollar sign to all jQuery objects, like $target, so they are recognizable as such.

I very much appreciate your help and interest in the project. Please don't let this message prevent you from contributing a new solution. If you do send a new pull request, please send me your mailing address and shirt size in a private email, and I will send you a t-shirt! :)

  • Bill

This was referenced Jun 24, 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

Successfully merging this pull request may close these issues.

2 participants