[whatwg] Predefined classes are gone

Michel Fortin michel.fortin at michelf.com
Thu May 17 10:38:32 PDT 2007

Le 2007-05-17 à 12:22, Adrienne Travis a écrit :

> A lot of us loved the IDEA of predefined "classes", but didn't like  
> the idea of confusing THAT mechanism with the CSS class mechanism.

Personally, I really don't like thinking of class="" exclusively as a  
mechanism to associate styles. The fact that CSS makes it easy to  
select on a class name doesn't mean that class names are targeted at  
CSS. Predefined class names made that clear, now it's less clear.

While not much in favor at first, I started to like the idea of  
predefined class names after a while. What I like is that it doesn't  
try reinvent a new parallel mechanism for what class *should have  
been* from the start. I think the initial idea was that the class  
attribute would cover the the semantics while CSS the presentation of  
those semantics. The only problem is that earlier specs left those  
semantics undefined, with no way to define them unambiguously. This  
explains why many people, including some standard advocates, started  
thinking of class as a way to attach style rules of the same name to  
their elements (basically making class presentational).

So either we fix class, or we create a new attribute (role) (and  
leave class as a purely presentational hook for CSS? Hurk!). The  
advantage of class is that it's a lot easier to use in CSS selectors,  
making authors more likely to use them. The advantage of role is that  
it begins in a clean state, which could mean less false-positive --  
I'm not sure this will stay true in the long run however, especially  
if people see role as "more semantic" than class and start to use it  

I'd tend to think there are use cases where class is most appropriate  
and others where it'd be better to start with a clean new attribute  
(role), but that's just a general feeling based on everything I've  
seen to date.

Michel Fortin
michel.fortin at michelf.com

More information about the whatwg mailing list