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

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 UTC