backbone icon indicating copy to clipboard operation
backbone copied to clipboard

Passive or non-passive event listeners

Open ffMathy opened this issue 7 years ago • 3 comments

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.

ffMathy avatar May 01 '18 07:05 ffMathy

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

jgonggrijp avatar Jan 02 '22 19:01 jgonggrijp

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.

Rayraz avatar Jan 02 '22 20:01 Rayraz

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.

jgonggrijp avatar Jan 02 '22 22:01 jgonggrijp