-
Notifications
You must be signed in to change notification settings - Fork 264
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
Give a proper example of originalEvent, discourage use of jQuery.event.props #405
Comments
Are you telling jQuery isn't passing the touches property on in its custom event object. As described in the event object's documentation, you can use event.originalEvent in your first example to access the "special properties" it has while still getting the benefits of the jQuery normalized event object, e.g. $('.image').bind('touchstart', function(event) {
alert(event.originalEvent.touches.length);
}); Or you can use the following jquery code |
originalEvent needs to be properly documented. The line "Certain events may have properties specific to them" is weak and doesn't lead the reader to conclude that originalEvent is useful. Certainly examples should be given. |
Since this is tagged as help wanted, we'd be glad to consider a pull request. Everyone here is a volunteer. |
See jquery/jquery#3112. As @silverwind pointed out, we've now removed |
I've added the |
Might be good to make a changelog entry too for the removal of |
@silverwind What changelog do you have in mind? |
Ah, you probably mean the |
I see you're not keeping a formal changelog. I meant the blog posts, like this one. |
@silverwind OK. :) We've already added the description to the upgrade guide; there are no links to this page yet, we'll include one in the blog post summarizing the 3.0.0 release. |
jQuery.event.props has been removed, so it necessary to access event.originalEvent for non-common properties. Fixes: jquery#405
https://jquery.com/upgrade-guide/3.0/ * event.props removed https://jquery.com/upgrade-guide/3.0/#breaking-change-jquery-event-props-and-jquery-event-fixhooks-removed jquery/api.jquery.com#405 * jqXHR.success(), jqXHR.error(), and jqXHR.complete() removed
event.props was removed in jquery 3 (jquery/api.jquery.com#405). It looks like this wasn't doing anything useful, and broke the schedule editor.
https://jquery.com/upgrade-guide/3.0/ * event.props removed https://jquery.com/upgrade-guide/3.0/#breaking-change-jquery-event-props-and-jquery-event-fixhooks-removed jquery/api.jquery.com#405 * jqXHR.success(), jqXHR.error(), and jqXHR.complete() removed
Docs at http://api.jquery.com/category/events/event-object/ say to use
originalEvent
and then show the unadvisable practice of pushing additional properties on jQuery.event.props to be copied to the event object. Copying lots of properties slows down each delivered event.The text was updated successfully, but these errors were encountered: