- From: Joseph Orbegoso Pea <notifications@github.com>
- Date: Mon, 27 Jun 2016 22:26:05 -0700
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc:
- Message-ID: <w3c/webcomponents/issues/504/228951642@github.com>
@treshugart I can't see how to make it work with events. For example, how will the child know when to dispatch an event, as there's no way for the child to know it has been distributed? The only thing I can imagine is a poll-like method where the event is dispatched every so often, which is undesirable. Events seem like a way for an element to shout, but not receive a guaranteed response. Being able to know when an element is attached (we already can with connectedCallback) and when an element is distributed (even if access to the slot is denied) would really help. For example, if a child element knows it has been distributed, *then* it can fire an event and if it receives no response then we can guarantee that a parent exists or not without a poll-like mechanism, and we'd be able to know this information at the soonest possible moment in time (I'm assuming events are synchronous?). I'm wrestling with this because I really want to be able to create virtual scene graphs that mirror the flat tree. This makes sense from a rendering perspective, because that's what the browser does natively to render things, but in my case I want to have my own WebGL pipeline, so just like the browser I need to be able to know the flat tree structure to finally render what I want in WebGL, and I want to be able to throw meaningful warnings or error in the case that an HTMLElement is not distributed properly into a ShadowDOM tree. My [ComposedTreeProxy](https://github.com/w3c/webcomponents/issues/516) idea could probably be another way to solve this, whereby a child could read the proxy to determine if a certain parent exists (the proxy might be observable with MutationObserver in order to know when it's structure changes, or similar). But, this seems like a heavy-weight solution for my case of determining if a certain immediate flat-tree parent is present for a given child. Any other ideas? --- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/webcomponents/issues/504#issuecomment-228951642
Received on Tuesday, 28 June 2016 05:26:47 UTC