- From: Dominic Cooney <dominicc@google.com>
- Date: Wed, 29 Jan 2014 08:44:51 +0900
- To: Anne van Kesteren <annevk@annevk.nl>
- Cc: WebApps WG <public-webapps@w3.org>
- Message-ID: <CAHnmYQ_CSqjPQP+yLGV7nFE4VrgJ7YjNpP686aN-=sCcF7oVDg@mail.gmail.com>
My understanding is that these callbacks can be invoked at roughly two
points in time:
The first one is when the browser is about to return to script. An example
is:
<script>
x.setAttribute('a', 'b');
// before here
...
</script>
If x is a Custom Element with an attributeChangedCallback, setAttribute
will queue an attributeChangedCallback; when returning to script x's
callback queue will be processed. Of course there are APIs, like setting
innerHTML, which can queue work for >>1 element.
The second one is when performing a microtask checkpoint. An example is:
<x-a></x-a>
If X-A has a Custom Element definition, the parser will queue an upgrade
step. At the next microtask checkpoint that element's callback queue will
be processed.
If you're having a discussion about callbacks in the context of microtasks,
that latter case, plus Mutation Observers, are probably of interest to you.
HTH,
Dominic
On Wed, Jan 29, 2014 at 7:41 AM, Anne van Kesteren <annevk@annevk.nl> wrote:
> Can someone explain me, ideally in terms of examples, when these
> callbacks are invoked:
>
> http://w3c.github.io/webcomponents/spec/custom/#enqueuing-and-invoking-callbacks
> Are these different from microtasks? The way the specification reads
> at the moment suggests they are. If that is the case I'd prefer we
> have some more high-level discussion about introducing a new point
> when we want to call callbacks for DOM methods.
>
>
> --
> http://annevankesteren.nl/
>
>
--
Email SLA <http://goto.google.com/dc-email-sla> •
Google+<https://plus.sandbox.google.com/111762620242974506845/posts>
Received on Tuesday, 28 January 2014 23:45:18 UTC