W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2015

Re: [whatwg] DOM Events Proposal: EventListenerOptions 'mayCancel' for improved scroll performance

From: Boris Zbarsky <bzbarsky@mit.edu>
Date: Sun, 12 Jul 2015 19:13:27 -0400
Message-ID: <55A2F497.2070609@mit.edu>
To: whatwg@lists.whatwg.org
On 7/12/15 12:47 PM, Ashley Gullen wrote:
> 1. Yes: statically references e.preventDefault
> 2. Maybe: some dynamic reference like e[str]
> 3: No: no dynamic references, and no static references to e.preventDefault
>
> Assuming the "maybe" case is rare

Is there data supporting this assumption?  I would expect that in 
practice in the cases that matter the "maybe" case is the common one. 
In particular, I expect that the maybe case includes the following 
situations:

1)  someObject[someName].call(event);
2)  someFunctionThatIsNotInlined(event);
3)  event[someName]();

Of these, I expect #2 to be the most common, then #1, then #3... and I 
expect #2 to be _very_ common.

> A simple way to determine the "no" case could be to identify handlers with
> no parameters at all, e.g:

Are these common in the case of the events we're talking about here? 
(Also, that's assuming window.event doesn't exist, and while that 
assumption is kinda ok today if you're writing cross-browser code that 
may cease being the case in the near future if Gecko ends up having to 
implement window.event.)

-Boris
Received on Sunday, 12 July 2015 23:14:07 UTC

This archive was generated by hypermail 2.3.1 : Sunday, 12 July 2015 23:14:07 UTC