Re: Custom Elements: insert/remove callbacks

On Thu, May 7, 2015 at 10:56 PM, Elliott Sprehn <esprehn@chromium.org>
wrote:

>
> On Thu, May 7, 2015 at 10:44 PM, Anne van Kesteren <annevk@annevk.nl>
> wrote:
>
>> On Fri, May 8, 2015 at 7:42 AM, Elliott Sprehn <esprehn@chromium.org>
>> wrote:
>> > That actually seems pretty similar to what we have, ours is in the form
>> of:
>> >
>> > Node#insertedInto(Node insertionPoint)
>> > Node#removedFrom(Node insertionPoint)
>> >
>> > where insertionPoint is the ancestor in the tree where a connection was
>> > added or removed which may be arbitrarily far up the ancestor chain.
>> From
>> > that you can figure out all the cases Boris is describing.
>>
>> Cool. So maybe the DOM specification needs to be updated to have that
>> model and we should expose that as low-level hook to web developers.
>>
>
> We'd consider adding a new MutationObserver type, we'd prefer not to add
> any more tree mutation callbacks. Anything you can do with those you can do
> with an ancestorChanged record type and takeRecords().
>

We should think hard before adding ancestor information to
MutationObservers; like other DOM-tree-related APIs, they are very much
based around the model of information coming up the tree from below (you
can imagine how odd it would be to add event dispatch that flowed down the
tree towards the leaves).

- Adam

Received on Friday, 8 May 2015 15:21:00 UTC