Hacker News new | ask | show | jobs
by Javve 5362 days ago
The reason is simply that I wanted it to be as simple as possible, but if it seems to be a common request I could add support for data-attributes! (and yes, it "works" in IE, by using getAttribute())
1 comments

i used to use class names to store data types (category is a perfect example). there's a really great reason to do this: you can style your objects based on that type of data without relying on CSS attribute selectors.

that said, i quickly learned that it's better to use data- attributes and copy them into the class when necessary. otherwise you end up with utilities like getCategoryFromClassName()