-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Allowing angular-touch to work with jQuery. #8584
Conversation
When jQuery is included touches are found on event.originalEvent
(if we do merge this, we will take @jasonals' patch, add tests, and rebase it properly against the master branch) |
02dc2aa
to
fd2d6c0
Compare
cad9560
to
f294244
Compare
e8dc429
to
e83fab9
Compare
4dd5a20
to
998c61c
Compare
@petebacondarwin - this issue has been annoying for me too, so I decided to try creating some tests for it. I could unfortunately come up with just one that would fail without the patch, and I created PR #10797 that has the test in it. I'll be happy to write more tests, but I haven't been able to find a way to emulate touch events properly: Any way you could help me with it? Or maybe just accept the PR in its current state? |
LGTM. Generally, in jQuery the original event is always available at Why didn't current unit tests catch this? They run on jQuery as well. |
@mcmar you have linting errors, see why the Travis build failed. |
@mzgol - I've fixed the linting errors in PR #10797 that contains changes from this PR. |
@pomerantsev I commented under #10797. |
If jQuery was used with Angular the touch logic was looking for touches under the original event objects. However, jQuery wraps all events, keeping the original one under the originalEvent property and copies/normalizes some of event properties. Not all properties are copied, e.g. touches which caused them to not be recognized properly. Thanks to @mcmar & @pomerantsev for original patch ideas. Fixes #4001 Closes #8584 Closes #10797
I went in another direction as just assigning |
If jQuery was used with Angular the touch logic was looking for touches under the original event objects. However, jQuery wraps all events, keeping the original one under the originalEvent property and copies/normalizes some of event properties. Not all properties are copied, e.g. touches which caused them to not be recognized properly. Thanks to @mcmar & @pomerantsev for original patch ideas. Fixes angular#4001 Closes angular#8584 Closes angular#10797
If jQuery was used with Angular the touch logic was looking for touches under the original event object. However, jQuery wraps all events, keeping the original one under the originalEvent property and copies/normalizes some of event properties. Not all properties are copied, e.g. touches which caused them to not be recognized properly. Thanks to @mcmar & @pomerantsev for original patch ideas. Fixes angular#4001 Closes angular#8584 Closes angular#10797
If jQuery was used with Angular the touch logic was looking for touches under the original event object. However, jQuery wraps all events, keeping the original one under the originalEvent property and copies/normalizes some of event properties. Not all properties are copied, e.g. touches which caused them to not be recognized properly. Thanks to @mcmar & @pomerantsev for original patch ideas. Fixes angular#4001 Closes angular#8584 Closes angular#10797
If jQuery was used with Angular the touch logic was looking for touches under the original event object. However, jQuery wraps all events, keeping the original one under the originalEvent property and copies/normalizes some of event properties. Not all properties are copied, e.g. touches which caused them to not be recognized properly. Thanks to @mcmar & @pomerantsev for original patch ideas. Fixes angular#4001 Closes angular#8584 Closes angular#10797
If jQuery was used with Angular the touch logic was looking for touches under the original event object. However, jQuery wraps all events, keeping the original one under the originalEvent property and copies/normalizes some of event properties. Not all properties are copied, e.g. touches which caused them to not be recognized properly. Thanks to @mcmar & @pomerantsev for original patch ideas. Fixes angular#4001 Closes angular#8584 Closes angular#10797
If jQuery was used with Angular the touch logic was looking for touches under the original event object. However, jQuery wraps all events, keeping the original one under the originalEvent property and copies/normalizes some of event properties. Not all properties are copied, e.g. touches which caused them to not be recognized properly. Thanks to @mcmar & @pomerantsev for original patch ideas. Fixes #4001 Closes #8584 Closes #10797 Closes #11488
If jQuery was used with Angular the touch logic was looking for touches under the original event object. However, jQuery wraps all events, keeping the original one under the originalEvent property and copies/normalizes some of event properties. Not all properties are copied, e.g. touches which caused them to not be recognized properly. Thanks to @mcmar & @pomerantsev for original patch ideas. Fixes angular#4001 Closes angular#8584 Closes angular#10797 Closes angular#11488
Angular includes a small subset of jQuery out of the box called jqLite. Normally, angular wraps all the elements it passes to its directives in jqLite. When jQuery is loaded ahead of angular, angular instead wraps its elements in the full implementation of jQuery. Additionally, angular wraps its events in jQuery. These jQuery events work throughout most of angular. Angular-touch currently was not working with those jQuery-wrapped events. Touches were registering inconsistently and rarely when using the ngClick directive. This commit should fix that. I took it from another person I found on github. I'm not sure why his changes were never merged into the main angular.js repo, but I've verified that it works and I decided to submit a pull request for it. There is a bug/issue thread I found relating to this. It is linked below.
#4001