- From: Elliott Sprehn <esprehn@chromium.org>
- Date: Sun, 12 Jul 2015 14:52:22 -0700
- To: Anne van Kesteren <annevk@annevk.nl>
- Cc: "olli@pettay.fi" <olli@pettay.fi>, Rick Byers <rbyers@chromium.org>, Tim Dresser <tdresser@chromium.org>, WHATWG <whatwg@whatwg.org>, Boris Zbarsky <bzbarsky@mit.edu>, Domenic Denicola <d@domenic.me>, Dave Tapuska <dtapuska@chromium.org>, Jonas Sicking <jonas@sicking.cc>
On Sat, Jul 11, 2015 at 11:40 PM, Anne van Kesteren <annevk@annevk.nl> wrote: > On Sat, Jul 11, 2015 at 11:41 PM, Rick Byers <rbyers@chromium.org> wrote: > > What Anne describes is perfect! I'm not hung up on the value of > cancelable > > itself - some internal bit on Event that makes preventDefault a no-op (or > > event throw) during listener invocation is fine with me (and I agree - > less > > weird). If code really wants to test whether it's call to preventDefault > > took effect, it can check defaultPrevented afterward. > > No, that is not what I said. I said we'd disable preventDefault() for > the listeners that have this bit set. If all listeners for a given > event have the bit said, the UA can make the optimization. > [...] This is what I had in mind as well. Also it occurs to me there's a missing primitive here for how the browser knows that all listeners have mayCancel: false so it can make this optimization. EventTarget needs some kind of method like: boolean hasOnlyPassiveEventListeners(DOMString type) so the scroll system can query if all listeners have mayCancel: false to make the optimization. Adding this also has the advantage of making it easy to feature detect if the browser supports this, just look to see if the hasOnlyPassiveEventListeners property exists on Node. - E
Received on Sunday, 12 July 2015 21:53:31 UTC