> On Apr 27, 2015, at 5:43 PM, Steve Orvell <sorv...@google.com> wrote:
>> 
>> That might be an acceptable mode of operations. If you wanted to 
>> synchronously update your insertion points, rely on custom element's 
>> lifecycle callbacks and you can only support direct children for 
>> distribution. 
> 
> That's interesting, thanks for working through it. Given a `childrenChanged` 
> callback, I think your first proposal `<content>.insertAt` and 
> `<content>.remove` best supports a synchronous mental model. As you note, 
> re-distribution is then the element author's responsibility. This would be 
> done by listening to the synchronous `distributionChanged` event. That seems 
> straightforward.
> 
> Mutations that are not captured in childrenChanged that can affect 
> distribution would still be a problem, however. Given:
> 
>     <div id="host">
>       <div id="child"></div>
>     </div>
>     
>     child.setAttribute('slot', 'a');
>     host.offsetHeight;
> 
> Again, we are guaranteed that parent's offsetHeight includes any contribution 
> that adding the slot attribute caused (e.g. via a #child[slot=a] rule)
> 
> If the `host` is a custom element that uses distribution, would it be 
> possible to have this same guarantee?
> 
>     <x-foo id="host">
>       <div id="child"></div>
>     </x-foo>
>     
>     child.setAttribute('slot', 'a');
>     host.offsetHeight;

That's a good point. Perhaps we need to make childrenChanged optionally get 
called when attributes of child nodes are changed just like the way you can 
configure mutation observers to optionally monitor attribute changes.

- R. Niwa


Reply via email to