Hacker News new | ask | show | jobs
by troels 4386 days ago
I generally try to not manipulate properties directly through javascript, rather declaring a class for the purpose. Doesn't seem like an unreasonable requirement for proper performance? (I mean, compared to having stuff like `will-change`)
2 comments

But you still use Javascript to apply the class to the element, right? So how can the browser know that your Javascript might do that?

It seems to me to know that a rule along the lines of "might-add-class: foo;" would get us back most of that separation of presentation and content.

It is an unreasonable requirement in places, though. Before now I've made things like swipable elements that track the user's touch - i.e., you touch down, pull your finger left and the box follows you. That's not possible to do in pure CSS.