It has become very JavaScript-like and this is why I always try to see if I can do something in CSS first before I resort to JS.
[0] https://www.w3.org/TR/css-nesting-1/
[1] https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes
It has become very JavaScript-like and this is why I always try to see if I can do something in CSS first before I resort to JS.
[0] https://www.w3.org/TR/css-nesting-1/
[1] https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes
In places where CSS takes expressions, they're always declarative, functional expressions; and they're always guaranteed to auto-update when their dependent values update, instantaneously as part of the update to the dependent values. Like an Excel grid-cell.
To me, however constrained "programming" in CSS still is, this makes for far better "programming ergonomics" than JS could ever give me — which, as you say, has me always reaching for a CSS solution before one in JS.
CSS is actually compiled. WebKit uses a Just In Time (JIT) compiler [1]; I suspect all modern web engines do something similar.
[1]: https://webkit.org/blog/3271/webkit-css-selector-jit-compile...
The primary difference between a traditionally compiled language (like C) and CSS and JavaScript is C is compiled before execution and CSS and JavaScript are compiled during execution.
There’s a reason why JIT stands for Just In Time compilation [1].
The correct difference to make is the execution model, one being basically a Turing machine while the other is more similar to logic programming languages.
If JavaScript is not compiled how does hoisting work?
CSS in my eyes should be able to handle 99% of visual style related needs with ease, JS should be there for the rest.
The WebKit team first proposed keyframe animation in 2009 [1], so that’s been here for a while.
You’ve pretty much always been able to do this via user style sheets [1], which override author (the author of the website you’re viewing) stylesheets.
[1]: https://developer.mozilla.org/en-US/docs/Web/CSS/Cascade#use...
Recently they added ":modal" that will make paywalls harder to bypass. Most sites haven't implement yet, but I've already disabled this "feature" on config.
The downside of cherry picking features is that your browser fingerprint becames pretty much unique.
Animation control is where things start to get weird.