In this case, CSS is shorter (229 characters VS 222) and easier to follow (subjective). Furthermore, in CSS you’d use a preprocessor to make it even shorter and grouped, e.g.
Stop using CSS in JavaScript for web development
Gajus Kuizinas

I suggest you to show an example based on attributes instead of classes. Css status shoud be use the aria-* attributes o normal attributes. So.. .button[aria-primary] is a better example ☺