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

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