-
Notifications
You must be signed in to change notification settings - Fork 116
appreciate your feedback for custom element diagram #163
Comments
I wish it was that simple, unfortunately it isn't. If the node is already on the document, and the document is fully parsed, and you define your custom element, there are no issues in reading, or even modifying, the node within its constructor, or within its attributeChanged callback. However, this is not the case if the element is pre-defined and encountered while parsing the document. In any case though, even the connectedCallback isn't safe to modify the node content, because the connected is invoked synchronously on node tag opened, but not necessarily on node tag closed. Accordingly, it's basically impossible through Custom Elements to be sure that a node content can be modified, and the only safe option to mutate such element is to use its Shadow Root element instead of the regular content. Or ... you need to define your components on document loaded. Or ... you need an indirection that tries to fix all these issues for you, like https://github.com/WebReflection/html-parsed-element#html-parsed-element does. |
Thanks for your fast, detailed and clear feedback. Personally I'm still concerned with (what I would call it) the asynchronous nature of custom elements. Do you agree with this wording? Thanks for the link, I will look into it. |
PS: great link, indeed |
This example below of this part of the spec also clearly demonstrates the "queued" integrity issue of |
I agree so much that I've proposed more reliable alternatives https://itnext.io/a-wicked-custom-elements-alternative-6d1504b5857f |
Really Awesome. You have just eliminated this asynchronicity design issue 🚀 IMHO I'm having a hard time to argue that custom elements are fragile and forces all developer's to rethink their synchronous paradigms to async 😱 |
In general I think that the fundament challenge is, that HTML and HTTP was never designed for components nor apps. It was made for documents being represented by hypertext. |
@WebReflection |
Hy @WebReflection
I just released an adapted version of the interactive react lifecycle methods diagram for custom elements:
https://andyogo.github.io/custom-element-reactions-diagram/
If you have time, I would appreciate your feedback very much.
The text was updated successfully, but these errors were encountered: