Skip to content

Swipe event: Trigger only one event per mouse sequence and let it bubble #6946

Closed
wants to merge 6 commits into from

3 participants

@gabrielschulhof

The element to which a mousedown handler is attached by the swipe setup() code
takes ownership of the next swipe event. This means that, if the same mousedown
event triggers other swipe setup() -attached mousedown handlers as it bubbles,
the subsequent ones will bail. Thus, if a swipe event results from the mousedown
then such a swipe event will be triggered on the deepest element with an
attached swipe handler, and it will be allowed to bubble from there. This
provides the tools that developers can use to avoid scenarios such as the one
mentioned in the referenced issue.

Fixes gh-6262

@coveralls

Coverage Status

Coverage decreased (-0.14%) when pulling 2ba7d5b on 6262-only-one-swipe-event into cfc1195 on master.

@coveralls

Coverage Status

Coverage increased (+0.29%) when pulling 65eda5f on 6262-only-one-swipe-event into cfc1195 on master.

gabrielschulhof added some commits Jan 14, 2014
@gabrielschulhof gabrielschulhof Swipe event: Trigger only one event per mouse sequence and let it bubble
The element to which a mousedown handler is attached by the swipe setup() code
takes ownership of the next swipe event. This means that, if the same mousedown
event triggers other swipe setup() -attached mousedown handlers as it bubbles,
the subsequent ones will bail. Thus, if a swipe event results from the mousedown
then such a swipe event will be triggered on the deepest element with an
attached swipe handler, and it will be allowed to bubble from there. This
provides the tools that developers can use to avoid scenarios such as the one
mentioned in the referenced issue.

Fixes gh-6262
fbe9239
@gabrielschulhof gabrielschulhof Swipe event: Track mouse handlers and remove only the ones tracked f5f0c53
@gabrielschulhof gabrielschulhof Unit tests: Add bubble-checking for swipe bb3ada6
@gabrielschulhof gabrielschulhof Unit tests: Make swipe tests run in Chrome as well as phantomjs 5d00bc7
@gabrielschulhof gabrielschulhof Swipe event: Use $.data() to store context d7542f3
@gabrielschulhof gabrielschulhof Unit tests: Make sure swipe cleans up its event handlers and only those aaafe08
@arschmitz
jQuery Foundation member

i think this looks good now just make sure to squash 👍

@gabrielschulhof gabrielschulhof deleted the 6262-only-one-swipe-event branch Jan 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.