W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2006

[whatwg] Semantic styling languages in the guiseof HTML attributes.

From: Matthew Raymond <mattraymond@earthlink.net>
Date: Sat, 23 Dec 2006 12:58:35 -0500
Message-ID: <458D6E4B.4010404@earthlink.net>
Mike Schinkel wrote:
> Why should attributes (only?) specify the details of semantics that elements
> already possess?

   Global attributes aren't necessarily wrong if their purpose is
orthogonal to the purpose of the elements they're being added to. That's
why |id| and |class| are so useful. They don't alter the semantics of
the element. Rather, they act as targets for styling and scripting.

   However, global attributes like |role|, |src| and |href| directly
compete with the semantics of HTML elements in many ways. We already see
this with |role| versus "HTML5". Many roles have semantics that overlap
with elements like <nav> (navigation), <article> (secondary), <aside>
(note) and <footer> (contentinfo).

> Is there an axiom or W3C finding that we can reference for this?

   Of course not. That's the problem. You see the power of markup being
shifted from elements to attributes to attribute values. The |role|
attribute itself is equivalent to having an infinite number of boolean
attributes.

>> Generally, though, this is just math. For every attribute
>> or role you have that can apply to ALL elements, you have the
>> semantics of all those  elements to interact with, plus you
>> have interactions between an indefinite number of global
>> attributes that may be defined on that element. 
> 
> Can you provide some concrete examples where that might cause a problem?

<input contenteditable readonly>
<input type="hidden" role="banner">
<output role="search">
<body role="seealso">
<body role="secondary">
<div role="main secondary">
<div role="main note">
<input type="checkbox" role="wairole:textbox">
<input type="file" role="wairole:checkboxtristate">
<input type="hidden" href="http://whatwg.org">
<input type="hidden" src="http://whatwg.org/images/logo">
<script [...] href="http://whatwg.org" />
<input [..] role="wairole:textbox wairole:checkbox wairole:select">
<hr role="main">

   Granted, most people wouldn't put these together, but I was able to
create this list using only a handful of attributes and roles that have
already been proposed. Also, keep in mind that implementors have to
consider these interactions whether people use these attributes and
roles together or not.
Received on Saturday, 23 December 2006 09:58:35 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:31 UTC