Events: modified touch.js to prevent scroll event listeners failing on re-binding. #5388

Closed
wants to merge 2 commits into
from

3 participants

@yosske

Events: modified touch.js to prevent scroll event listeners failing on re-binding.

===The Bug===
The handler binded to the scroll event in the "scrollStart" event's "start" function isn't being unbinded when ".unbind('scroll',someHandler)" is called. This causes the handler to be added multiple times to an element each time the element is binded to the scroll event, even if ".unbind" was called, thus preventing the programmers' supplied handler from listening to the event once a second "bind" was performed.
===The Fix===
I've added a "teardown" function to the event that performs the needed unbinding. (In order to unbind the specific handler I've changed it from an anonymous function to a function property inside the event's namespace).

Cheers :)

@yosske yosske Fixed bug:
===The Bug===
The handler binded to the scroll event in the "scrollStart" event's "start" function isn't being unbinded when ".unbind('scroll',someHandler)" is called. This causes the handler to be added multiple times to an element each time it is binded to the scroll event, even if ".unbind" was called, thus preventing the programmers' supplied handler from listening to the event.
===The Fix===
I've added a "teardown" function to the event that performs the needed unbinding. (In order to unbind the specific handler I've changed it from an anonymous function to a function property inside the event's namespace).

Cheers :)
d398582
@gseguin
jQuery Foundation member

@yosske, Thank you for the pull request! It seems like you haven't signed a CLA. Please visit http://contribute.jquery.org/CLA/ and sign it so we can look into your PR.

Thank you.

@yosske

I signed a CLA. Please also take into account the recent commit I pushed which fixed an unintentional creation of a Global Variable which was introduced in the first commit.

Thanks!

@arschmitz
jQuery Foundation member

Closing this PR because there are conflicts and some of this has been implemented already

@arschmitz arschmitz closed this Aug 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment