This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(ngTouch): register touches properly when jQuery is used #11471
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Mar 31, 2015
Closed
f7071e7
to
2082f94
Compare
The problem with tests for this PR is that without those changes they still pass in currently tested desktop browsers. If you run them in e.g. mobile Safari, they'd fail (with my PR they pass). I didn't find a good way to make them fail on desktop browsers as well, can we make the test run on at least one mobile browser? At lest unit tests? |
x = x || 0; | ||
y = y || 0; | ||
|
||
var touch = document.createTouch(window, element, new Date().getTime(), x, y, x, y); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would change to Date.now(), as I've seen in other places of Angular's codebase.
This is great. |
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
I'll need to merge #11479 before this one to be able to run the tests on mobile Safari. |
Landed as 06a9f0a |
gkalpak
added a commit
that referenced
this pull request
Apr 2, 2015
…h enabled Chrome On certain browsers (e.g. on desktop Chrome with touch-events enabled), using the `initTouchEvent()` method (introduced in 06a9f0a) did not correctly initialize the event, nor did the event get dispatched on the target element. Using the `Event` constructor and manually attaching a `TouchList`, works around the issue (although not a proper fix). Fixes #11471 Closes #11493
gkalpak
added a commit
that referenced
this pull request
Apr 2, 2015
…h enabled Chrome On certain browsers (e.g. on desktop Chrome with touch-events enabled), using the `initTouchEvent()` method (introduced in 06a9f0a) did not correctly initialize the event, nor did the event get dispatched on the target element. Using the `Event` constructor and manually attaching a `TouchList`, works around the issue (although not a proper fix). Fixes #11471 Closes #11493
netman92
pushed a commit
to netman92/angular.js
that referenced
this pull request
Aug 8, 2015
netman92
pushed a commit
to netman92/angular.js
that referenced
this pull request
Aug 8, 2015
…h enabled Chrome On certain browsers (e.g. on desktop Chrome with touch-events enabled), using the `initTouchEvent()` method (introduced in 06a9f0a) did not correctly initialize the event, nor did the event get dispatched on the target element. Using the `Event` constructor and manually attaching a `TouchList`, works around the issue (although not a proper fix). Fixes angular#11471 Closes angular#11493
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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