Is there any reason you would not want to apply a class to an element and then modify the class?
For example, let's say you were going to have a dynamic scale value that you can change to any value using a slider. You could change that using the following:
var value = mySlider.value;
element.style.transform = "scale(.532)";
and update it that way.
But what if you created a class like this:
.myElementScale {
transform: scale(.532);
}
And added it to the element. Then when you changed the slider value you updated the class declaration:
var declaration = getStyleDeclaration(".myElementScale"); //pseudo code
declaration.setStyle("transform", "scale(.532)");
Is there any reason not to do this? I ask because I have not seen anyone else doing this and wonder if there are performance issues with it. I'd rather not set styles directly but the style value can be dynamic so it has to be set somewhere.