Using CSS classes and - depending on the case - IDs (unique!!) is perfectly fine and often the only solution to keep your HTML code valid while giving additional attributes used by scripts.
While using non-standard attributes often works fine, too, it will prevent your html code from validating and might cause issues in the future.
However, for some cases there might be attriutes which can be used, too - like rel on links which is often used for scripts which modify link behaviour.
http://www.w3.org/TR/html401/struct/global.html#h-7.5.2 also mentions that class is general-purpose:
The class attribute, on the other
hand, assigns one or more class names
to an element; the element may be said
to belong to these classes. A class
name may be shared by several element
instances. The class attribute has
several roles in HTML:
- As a style sheet selector (when an author wishes to assign style information to a set of elements).
- For general purpose processing by user agents.