generators inside DOM events

Andrea Giammarchi andrea.giammarchi at
Wed Jan 8 13:05:37 PST 2014

Sorry, I explained it badly ... let me try again:

what if a DOM event handler uses/creates/invokes inside its function body a

Will the event pause until this will be satisfied?

`a.addEventListener('click', function(e){ if(methodThatInvokesGenerator())
e.stopPropagation(); });`

Is this a concern?


On Wed, Jan 8, 2014 at 12:53 PM, Domenic Denicola <
domenic at> wrote:

>  What? That would just cause the event handler function to return a
> generator object, which the browser would not use or do anything with. It
> would have no effect.
>  ------------------------------
> *From:* es-discuss <es-discuss-bounces at> on behalf of Andrea
> Giammarchi <andrea.giammarchi at>
> *Sent:* Wednesday, January 08, 2014 15:50
> *To:* es-discuss at
> *Subject:* generators inside DOM events
>  I am not sure this has been discussed already but I wonder what would
> happen if `yield` is used inside an event such 'beforeunload', 'unload', or
> even 'click' and others DOM related events.
>  Main concerns:
>    1. it's a UA trap potentially making impossible to leave a page or
>    complete a user meant action
>    2. not even transpilers can solve cases like this (i.e. a still valid
>    event eventually stopped after some generator logic where if simulated the
>    event would be expired at the time the function will be invoked)
> Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list