Re: [custom-elements] Invoking lifecycle callbacks before invoking author scripts

2016-02-24 Thread Ryosuke Niwa

> On Feb 23, 2016, at 1:16 AM, Anne van Kesteren  wrote:
> 
> On Tue, Feb 23, 2016 at 5:26 AM, Ryosuke Niwa  wrote:
>> Hi,
>> 
>> We propose to change the lifecycle callback to be fired both before invoking 
>> author scripts (e.g. for dispatching events) and before returning to author 
>> scripts.
>> 
>> Without this change, event listeners that call custom elements' methods 
>> would end up seeing inconsistent states during compound DOM operation such 
>> as Range.extractContents and editing operations, and we would like to avoid 
>> that as much as possible.
> 
> These are the events we wanted to try and delay to dispatch around the
> same time lifecycle callbacks are supposed to be called?

Yeah, I'm talking about focus, unload, etc... and DOM mutation events.  It's 
possible that we can make all those event async in the future but that's not 
the current state of the world, and we would like to keep the custom elements' 
states consistent for authors.

- R. Niwa




Re: [custom-elements] Invoking lifecycle callbacks before invoking author scripts

2016-02-24 Thread Elliott Sprehn
Can you give a code example of how this happens?
On Feb 24, 2016 8:30 PM, "Ryosuke Niwa"  wrote:

>
> > On Feb 23, 2016, at 1:16 AM, Anne van Kesteren  wrote:
> >
> > On Tue, Feb 23, 2016 at 5:26 AM, Ryosuke Niwa  wrote:
> >> Hi,
> >>
> >> We propose to change the lifecycle callback to be fired both before
> invoking author scripts (e.g. for dispatching events) and before returning
> to author scripts.
> >>
> >> Without this change, event listeners that call custom elements' methods
> would end up seeing inconsistent states during compound DOM operation such
> as Range.extractContents and editing operations, and we would like to avoid
> that as much as possible.
> >
> > These are the events we wanted to try and delay to dispatch around the
> > same time lifecycle callbacks are supposed to be called?
>
> Yeah, I'm talking about focus, unload, etc... and DOM mutation events.
> It's possible that we can make all those event async in the future but
> that's not the current state of the world, and we would like to keep the
> custom elements' states consistent for authors.
>
> - R. Niwa
>
>
>