- From: Andrea Giammarchi <notifications@github.com>
- Date: Mon, 01 Apr 2024 09:35:56 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <WICG/webcomponents/issues/809/2030119706@github.com>
> Say a component has many children, is there any chance the parser may connect the component after parsing some of the children if you define your component at the end of the page you are 100% sure you can access its children and everything else as it gets just "*promoted*" as CE ... if you define your component AOT (which is 90% of what libraries do instead of lazy dafining their components only when needed/encountered) you are 100% sure (last time I've checked) the `connectedCallback` will trigger instantly after `attributeChangedCallback` in case it was defined and the attribute is observed and encountered ... at that point the browser hasn't parsed yet the content of that element so you'll fallback with MutationObserver for children which guarantees nothing but usually it works "*good enough*". The whole issue is to have something that never fails and that can be used in all circumstances and definition time, something that while streaming a document will signal via `closedCallback` that its ending has been encountered, something that even with lazy / late definitions will still trigger after the `connectedCallback`. The problem raised in here is that in some streaming scenario the browser might already consider the element closed ... add people with "*smart suggestions*" like "*don't need to close a* `<p>` *or a* `<li>`" 'cause the browser does that for you, see early hacks on never closing a `<body>` because the browser does that for you (and the legend say it's faster in doing so) and so on ... so the issue remains and solutions are all awkward in a way or another, or really not applied via lazy custom elements definition, something I've explored ages ago, something that works and never suffers the issue itself but developers don't like it for other reasons (FOUC or other related shenanigans that might be indeed a concern specially with 100% ShadowDOM based components). -- Reply to this email directly or view it on GitHub: https://github.com/WICG/webcomponents/issues/809#issuecomment-2030119706 You are receiving this because you are subscribed to this thread. Message ID: <WICG/webcomponents/issues/809/2030119706@github.com>
Received on Monday, 1 April 2024 16:36:00 UTC