Re: [webcomponents]: What callbacks do custom elements need?

On Wed, Mar 6, 2013 at 2:05 PM, Dimitri Glazkov <dglazkov@google.com> wrote:

> ...
> * insertedCallback -- asynchronously called when an element is added
> to document tree (TBD: is this called when parser is constructing the
> tree?)
>
> * removedCallback -- asynchronously called when an element is removed
> from the document tree (except the situations when the document is
> destroyed)
>

The inserted and removed callbacks need to happen in
batches asynchronously, specifically if I have a tree:

A
  \
   B
   / \
 C   D

And B and D are custom elements and then I remove A, the remove should
happen first and then B and D should be notified after the removal and all
clean up has happened. We don't want to reinvent mutation events here.

insertedCallback should happen the same way. We should fully construct the
tree first and then all of them get called in a big batch at the end.

- E

Received on Wednesday, 6 March 2013 22:14:01 UTC