3 ms·
Thanks for commenting! I just did a pass over the vanilla JS examples addressing some of these issues. Wrt. transitions: > use CSS and a transition listener o
by deniz-a 5y ago
Thanks for commenting! I just did a pass over the vanilla JS examples addressing some of these issues.
Wrt. transitions:
> use CSS and a transition listener on the JS side
Now you need to have 3 files open in your editor simply to be able to say "this button fades away in half a second when clicked". The onclick is used to somewhat alleviate this (See "Locality of Behavior" [1]).
Separation of concerns is important, but different applications have different definitions of what constitutes a "concern". If one expects that the hiding animation will be changed by designers, one would likely use CSS as you suggested. The nice thing about `settle` in hyperscript (as opposed to just listening for a transitionend) is that you can switch from a transition to a keyframe animation and it will still work with no changes.
> add a transition end listener on the document
Wouldn't this also detect non-disappearing transitions (say, an element expanding or changing color)?
[1]: https://htmx.org/essays/locality-of-behaviour/ https://htmx.org/essays/locality-of-behaviour/
- TheRealPomax 5y ago> Now you need to have 3 files open in your editor Are you saying that isn't already the case? Do you inline all your CSS and JS directly? Because that'd be super weird. > Wouldn't this also detect non-disappearing transitions (say, an element expanding or changing color)? The event comes with information about which class the transition was for. So: sure, but if you have lots of different transitions we're no longer dealing with simple code that we can write simple "vanilla vs. jquery vs. your lib" code for?