Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore element and children in morph #50

Open
daaku opened this issue Apr 14, 2024 · 1 comment
Open

ignore element and children in morph #50

daaku opened this issue Apr 14, 2024 · 1 comment

Comments

@daaku
Copy link

daaku commented Apr 14, 2024

I'm using this successfully for an improved experience with various input fields in forms (via htmx). Part of my replace target though includes large number of elements, which I know in advance can be ignored. As far as I can tell there isn't a way to indicate that an element and it's children should be ignored by the morphing algorithm to improve the performance is there?

The UX pattern here is fairly simple - a search results page with a form of inputs to control the search, and a large table/list of results. The form of inputs needs to be replaced in order to reflect the updated hidden fields etc that are related to the visible input elements. So the hx-swap targets the element containing the form as well as the results.

@domingo2000
Copy link

Hi!, Im having the same issue. I need a callback like onBeforeElChildrenUpdated in morphodom to tell the morphing algorithm to swap the node for the new node instead of just morphing. My issue here is that i have components that need to be deleted/added to the DOM to work (works with node change, but not on morph when updating attributes), and i want to recursively pick wich childrens are going to be morphed and which don't.

It would be nice to give some callbacks that fine-tune the algorithm for diferent cases, im thinking like a visitor patern when walking through an AST in static syntax analysis. The DOM is an tree with it's children and to make ideomorph more flexible is useful to have access to the desicions of the algorithm in all the tree, not just the node beign morphed. ¿What do you think about it? ¿How does performance get affected if it is needed to call this callback?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants