W3C home > Mailing lists > Public > public-html@w3.org > April 2007

Use the role-attribute instead of predefined class names

From: Daniel Schattenkirchner <schattenkirchner.daniel@gmx.de>
Date: Thu, 05 Apr 2007 21:26:24 +0200
Message-ID: <46154D60.8000204@gmx.de>
To: public-html@w3.org

Hello, the following issue was already raised a few times, however, 
there was no "big discussion" about it yet.

In my opinion the XHTML 2 role-attribute is far superior to the Web 
Applications 1.0 predefined class names because the latter got several 
disadvantages:

I don't think they are what most here call backward compatible. 
Predefined class names are limited to few elements. I'm using class 
names like "copyright" already and, like many other authors, I'm not 
only using it on p- and span-elements. It'd be confusing if some 
elements with class name X got a different meanign than special elements 
with class name X. Also It's unclear how elements with class names that 
aren't allowed on that element should be handled. Are they invalid or 
ignored. I think that part of the WA-Spec is very imature. (Adding new 
class names could be very chaotic very soon).
The same problem is applying to class names that aren't yet predefined, 
but may become so in the future.

Redundancy is alo a point that comes to my mind. I personally would use 
a div- or section-element with the class name "copyright" as a parent 
for copyright-specific paragraphs and lists. I think that's better that 
a series of p-elements wearing the class name "copyright".

Frankly speaking, I think predefined class names are confusing and make 
an authors life harder. You've got to now, class name X is predefined 
and class name Y can only be used on element Z. Not very intuitive IMHO.

My idea would be to merge the role-attribut with the predefined class 
names (e.g. role="copyright"). This is reflecting my way of using that 
class name (grouping elements in a div-element with the 
copyright-class). However, together with the role-attribute, an element 
would be enhanced semantically, which can be used by search enginges and 
similar user agents.
Besides, I think this approach is more useful when working with CSS.

~ ds
Received on Thursday, 5 April 2007 19:26:18 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:38:42 UTC