Re: Custom Elements: insert/remove callbacks

On May 9, 2015 9:41 AM, "Anne van Kesteren" <annevk@annevk.nl> wrote:
>
> On Fri, May 8, 2015 at 2:50 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> > On 5/8/15 1:42 AM, Elliott Sprehn wrote:
> >> That actually seems pretty similar to what we have, ours is in the form
> >> of:
> >>
> >> Node#insertedInto(Node insertionPoint)
> >> Node#removedFrom(Node insertionPoint)
> >
> > To be clear, ours is also in the form of two methods
> > (BindToTree/UnbindFromTree) that take various arguments.
>
> The DOM only has insert/remove hooks:
>
>   https://dom.spec.whatwg.org/#concept-node-insert-ext
>   https://dom.spec.whatwg.org/#concept-node-remove-ext
>
> So that seems clearly wrong (in the specification)... Are descendants
> notified in tree order?

Yes, and anything that can run script is notified in a second pass. So for
example if you create a script, put it in a subtree, then append the
subtree, the script runs after all insertedInto notifications have been
sent to the subtree.

- E

Received on Saturday, 9 May 2015 17:12:15 UTC