He was talking about jQuery selectors and such, and someone in the audience asked, "So it uses CSS to select elements?" Joe replied with a little explanation, but essentially said, "Yes, it uses CSS selectors." Immediately I was compelled to raise my hand to clarify... "Well, it's not so much that it uses CSS selectors. Think of it more that jQuery and CSS use the same selectors to identify elements in the DOM. It doesn't really belong to either of them." This prompted a very short discussion about how one can decorate elements with classes that have no CSS purpose and serve only for jQuery selection. Joe said, "That's interesting, and I can't say I've ever used classes for non-CSS purposes before jQuery."
I didn't want to derail the session, so I kept my ongoing thoughts to my self where they've been stirring for a few days. But ultimately, my thought was...
Can one effectively think of class specifications on HTML elements as analogous to interfaces on class implementations?For some reason I'm fascinated by this question. What are the implications, if any? From the point of view of the selectors, it makes sense. For example, if you want all of the "td" elements in the document, you can select them by their type. Essentially, you're looking for a particular element implementation, "td." Class specifications, on the other hand, are element-agnostic. You can select by "myClass" and get all elements which have that class, regardless of their type. Basically, all elements which implement the "myClass" interface regardless of the implementing type.
It's just... interesting.