Passive Event Listeners (EventListenerOptions)
This work is now part of the official WHATWG DOM spec. Please file any issues/pull requests there. This repository (and its resources / discussions) are only preserved here as an archive.
- See the main commit in the DOM specification or pull request for full details.
- The key parts of the spec affected by this are EventTarget, Observing event listeners, and preventDefault
- Touch Events has been updated to describe the performance optimization.
- Interventions issue 18 tracks the plan to "intervene" and force touch listeners to be passive in scenarios where the compat risk is low but the perf benefit large.
Status of implementations:
- See CanIUse entry for passive event listeners
- Chromium: shipping in Chrome 51 (launch bug)
- WebKit: EventListenerOptions support and performance optimization for touch listeners landed.
- Performance optimization of wheel listeners not yet implemented.
- Firefox: Landed - planned to ship in Firefox 49
- DOM4 Polyfill, or sample polyfill here
Additional background on the problem:
- Summary from Google I/O 2016 Mobile Web talk
- Ilya Grigorik's talk at Chrome Dev Summit [slides]
- Discussion on twitter with demo video
- Demo page with latency measurement
- Older G+ post by Rick Byers