jashkenas / backbone

Give your JS App some Backbone with Models, Views, Collections, and Events
http://backbonejs.org
MIT License
28.09k stars 5.39k forks source link

Passive or non-passive event listeners #4192

Open ffMathy opened 6 years ago

ffMathy commented 6 years ago

It would be nice if we could set the event handlers created to be passive or non-passive. That way we can also get rid of a warning in Chrome when working with events.

jgonggrijp commented 2 years ago

Please forgive my ignorance, but isn't an event listener always passive? I've never heard of this distinction before.

Rayraz commented 2 years ago

If I'm not mistaken, passive event listeners cannot cancel the events they receive, while active ones can.

Edit: I recalled it had something to do with scroll performance, turns out I was right: https://developers.google.com/web/updates/2016/06/passive-event-listeners

These days Chrome throws a warning if you use a non-passive event listener for an event that's potentially scroll-blocking, such as a touch event.

jgonggrijp commented 2 years ago

Thanks @Rayraz for jumping in, that really helps!

I studied the topic a bit and concluded that it's probably best to wait for https://github.com/jquery/jquery/issues/2871 to be resolved before implementing support in Backbone.