react-waypoint icon indicating copy to clipboard operation
react-waypoint copied to clipboard

Remove `passive` event listener flag?

Open trotzig opened this issue 8 years ago • 2 comments

I was reading up on EventTarget.addEventListener and came across this section:

Setting passive isn't important for the basic scroll event, as it cannot be canceled, so its listener can't block page rendering anyway.

We introduced passive listeners in 3ad940e, but I think that has no effect on performance and we can remove it. We do use it for both the scroll event and the resize event. I think it might have effect for resize, but performance isn't really important for that event (people don't normally resize their browsers).

@lencioni I'm interested to get your input here.

trotzig avatar Aug 18 '17 08:08 trotzig

After reading that article, and a few other ones on the topic, this seems right to me. But I'll also defer to @lencioni .

jamesplease avatar Aug 18 '17 16:08 jamesplease

Yeah, I think you are right--scroll and resize events can't be canceled. It seems fine to remove it.

lencioni avatar Aug 18 '17 16:08 lencioni