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

Re: Use the role-attribute instead of predefined class names

From: Matthew Raymond <mattraymond@earthlink.net>
Date: Sat, 07 Apr 2007 08:47:52 -0400
Message-ID: <461792F8.7050200@earthlink.net>
To: Laurens Holst <lholst@students.cs.uu.nl>
CC: public-html@w3.org

Laurens Holst wrote:
> Matthew Raymond schreef:
>>    Personally, if we're moving everything to XML, I don't see the point.
>> You can just use attributes and elements from a new namespace. The
>> |role| attribute just shift semantics to a lower structural priority
>> (from elements and attributes to attribute values).
> 
> In case of <section>, the advantage is in my opinion that instead of the 
> fact that it’s a section being implicit (like in <article>, <nav>, etc), 
> it’s good to have it explicitly being a section, and then specify the 
> type of section on the role attribute, as a means of sub-classing it. 

   First of all, an element specific attribute makes just as much sense
in this case because you don't necessarily want "section types" defined
on other elements.

   Secondly, using attributes for "subclassing" can be a descent into
madness:

| <div role="section article">...</div>
| <role="div section article">...</>

   Furthermore, not having elements means that if we want to add
attributes to a specific kind of "section", we have to put them on the
root element and instruct user agents to ignore the attributes for other
types. Also, without elements we can't impose any logical structural
restraints on the markup with regard to "sections".

> The way it is currently, which elements are exactly section types and 
> thus how they interact with headings is extremely unclear to me.

   I don't see how this is a problem. We can just define certain
semantics as applying to a group of elements rather than one. However, I
would be content to see the use of <h> limited to being inside <section>
elements specifically, in part because I prefer to have <section>
defined as a "section of an article" rather than a section of the document.

> Then again, I suppose it would depend on the exact definition in the 
> specification. If e.g. non-namespaced values were reserved for the HTML 
> specification, and authors were discouraged to invent any new role 
> attributes individually and to use the class attribute instead, I think 
> that problem might be avoided.

   The web page can't break when an unknown role pops up, especially if
new roles for HTML are defined at a later date and markup with these new
roles are viewed by a older user agent that supports roles. Therefore,
requiring that authors, and vendors for that matter, not invent their
own roles is pointless. They'll do whatever they want, and we'll be back
at square one.
Received on Saturday, 7 April 2007 12:46:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:15:52 GMT