Skip to content
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

Passive listeners #331

Open
TheComputerM opened this issue Feb 9, 2020 · 6 comments
Open

Passive listeners #331

TheComputerM opened this issue Feb 9, 2020 · 6 comments

Comments

@TheComputerM
Copy link

Feature description

I want to add passive behavior to my touchstart event listener which I have initialized through the $().on("touchstart", function) command. This is how we add passive event listeners in chrome https://stackoverflow.com/questions/37721782/what-are-passive-event-listeners

Feature motivation

This boosts performance in chrome considerably.

@fabiospampinato
Copy link
Owner

It's a good idea, but we are trying to be a jQuery alternative and jQuery doesn't (yet) have this functionality, so I think it would be better to wait until jQuery v4 is out, which I think should add support for this, and align with that.

@TheComputerM
Copy link
Author

I we are trying to be an alternative, then why not be a better one?

@TheComputerM
Copy link
Author

jquery/jquery#2871

@fabiospampinato
Copy link
Owner

"Alternative" might not have been the best word to describe Cash, it is (for the most part) a subset of jQuery, that means people can attempt to switch to it and from it pretty easily, that also means we don't have to write a proper thorough documentation and we can just point at jQuery's.

We could however still maintain those benefits by implementing this in a backwards-compatible manner and mentioning the difference with jQuery in the migration guide. I want however to keep our implementation aligned with jQuery's, but they don't have one yet. Most probably they will implement it differently which means eventually we'll have to publish a new major release.

Nothing insurmountable though, if anybody has a proposal about how to implement this I'm all ears.

@TheComputerM
Copy link
Author

Well, since jQuery is currently 60% of the way towards version 4 (https://github.com/jquery/jquery/milestone/7) we might as well wait for the syntax.

@fabiospampinato fabiospampinato changed the title Extra options for binding and event listener with the on function. Passive listeners Apr 15, 2020
@fabiospampinato
Copy link
Owner

A very decent way to add support for this could be a accepting an options object after the data object, that'd be backwards compatible and pretty clean.

jQuery can't do that because they accept multiple data arguments, I'm not sure why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants