Re: Extending Mutation Observers to address use cases of

On Feb 11, 2014, at 8:41 PM, Joshua Peek <> wrote:
> Are you proposing new mutation record type? I think that could handle
> most of the enter/leave requirements.

Not really.  I’m mostly talking about new timing at which mutation records are delivered.

Apparently we need to deliver records more “eagerly” for custom elements. 

> If MutationObservers are an open topic for extension, I'd love to see
> generic css selector support.
>  observer.observe(target, { selector: 'foo' });
>  observer.observe(target, { selector: '.foo' });
> That'd cover element name "enter" and "leaves" as well.

enteredView and exitedView are custom element callbacks and not elements themselves.

There has been some discussions to extend mutation observers to support better filtering.

We can probably support simple selector:

I don’t think we can support any arbitrary selector (e.g. descendent selector) for performance reasons since doing so requires tree traversal, and checking that condition on every DOM mutation is too expensive.

- R. Niwa

Received on Wednesday, 12 February 2014 05:32:09 UTC