On Feb 11, 2014, at 8:41 PM, Joshua Peek <[email protected]> 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.
http://w3c.github.io/webcomponents/spec/custom/#types-of-callbacks
There has been some discussions to extend mutation observers to support better
filtering.
We can probably support simple selector:
http://dev.w3.org/csswg/selectors4/#simple
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