hoplon 2019-12-29

@mdiin has joined the channel

Does Hoplon have an event that triggers immediately before a node enters or leaves the DOM?

Why I (think) I need this: I want to animate the filtering of a list, such that nodes that are not changed by the filter are smoothly transitioned to their new positions.

I found the hoplon.observer ns in brew, which adds support for mutation observers, and it does seem like a way to implement this, in combination with requestAnimationFrame. Any insights would be much welcome. 🙏

@mdiin afaik, mutation observers are the only way, hoplon doesn't have its own hooks

Thanks, that makes sense. I was hoping there was a more idiomatic way of doing this with hoplon, though I did suspect there wasn’t.

@mdiin I would recommend the css only approach with hoplon

the hoplon.observer namespace is still under active development, feel free to reach out if you need help

From what I have read, what I want to do is not possible with CSS only, because I need to apply css to new nodes before they are rendered for the first time. Now that I write this, I realise that I used the wrong example before, because maybe CSS transitioning on top and left will be enough to animate the element positions.

I will have to think some more on this before proceeding. Thanks.

@mdiin applying css happens in hoplon before the node is rendered, the css is applied while the element is in memory, before it’s added to the DOM