Re: [webcomponents] Need "slotting changed" event (#288)

Hopefully you guys don't mind me chiming in (I'm new here). I'd +1 a `MutationObserver` implementation, or something that does mutation batching with microtask timing.

@ajklein re:

> Is there a reason not to just use an event for this? Creating a new MutationRecord type that contains none of the usual MutationRecord fields seems odd. The trickiest part of using an event is getting it to fire at microtask timing, but I suspect we already have enough spec machinery to do that.

I assume you mean non-bubbling as per a previous comment you'd made. Would these events batch together mutations or would they fire for every mutation that was made?

FWIW, I'd vote for a `MutationObserver` implementation for a few reasons:

- Batching + microtask should be more performant than events. Prior art here is [DOM3 mutation events](https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Mutation_events). 1k distributed nodes in this case would cause 1k handlers to be run.
- Observation is explicit and since they're mutations, it'd be consistent with the `MutationObserver` model.
- Since observation is explicit, expecting a different type of `MutationRecord` would be expected.




---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/288#issuecomment-177872632

Received on Monday, 1 February 2016 09:25:13 UTC