Re: Namespace

HI Andrew,

On Jul 18, 2007, at 3:33 AM, Andrew Sidwell wrote:
> Robert Burns wrote:
>> Earlier you gave the example of changing something like <small>or
>> perhaps</small> to  <span class="small"> or perhaps <span>. However,
>> that's not the kind of change that would represent best practice.  
>> Best
>> practice would be to replace the presentational element with  
>> something
>> more meaningful. I think <span> and <div> both encourage those
>> practices.
>
> <span> and <div> are presentational hooks, so I don't see how using  
> them
> is not using presentational elements.

You can think of <span> and <div> as presentational hooks, but I  
would discourage anyone from doing so. You can think of every HTML  
element allowed in the <body> element content model (and <title>) as  
presentational hooks. They are all presentational hooks in the same  
way that <span> and <div> are presentational hooks. From a visual  
browser's point-of-view, it merely wants to know how to visually  
display this element or that element. From an aural browser's point- 
of-view, it wants to know just if and how it should speak this  
element's contents or that element's contents. It is perfectly fine  
for them to look at it that way. However, if we take the separation  
of semantics and style seriously, then what we want is to treat all  
of the elements — including <span> and <div> — as semantic elements.  
The @class attribute should be thought of as a semantic attribute  
just as we have semnatic elements. In other words, don't use "small",  
use "copyright". Don't use <span class='italics'>Moby Dick</span> use  
<span class='book-title'>Moby Dick</span>. Is it still a  
presentational hook? Definitely! In the same sense that <em> is a  
presentational hook. However, its a presentational hook that creates  
greater consistency in authoring. There's no need for authors to  
remember "how are we styling book titles again?". The author need  
only remember that "Moby Dick" is a book title.


>> So instead, one would expect a change from using <small> to
>> something like <span class="copyright"> Copyright 2007<span> or to  
>> <span
>> class="disclaimer">… <span>. These are the types of  meaningful class
>> names that often accompany <span> and <div>
>
> "Meaningful class name" is oxymoronic, as far as UAs go, and I assume
> you're not suggesting that everyone reads HTML in source form.  A  
> class
> name is an opaque string of text; "small" is no less meaningful than
> "copyright", or "fribblewibblewobble" for that matter.

Certainly if we only think like a visual browser; then like I said  
everything is just a visual presentational hook. However, this  
language has so much more potential than any of us can foresee. We  
need to think beyond the visual browser (or the presentational  
browser of any kind) . Even as presentational hooks, there are aural  
and tactile presentations. How do you present something aurally  
small? It would be better to use semantics and then provide  
presentational properties for each of those semantics. Rather than  
congealing several common, but distinct semantics into a single <i>  
element, we should be dividing them into separate semantic elements  
with default italics styling.

> Replacing a
> presentational element with e.g. span/div, AFAICS, leaves you with
> something no more meaningful than what you had originally.

No, if it helps encourage meaningful class names: especially if  
authors are guided to add meaningful @class names (even to the point  
of making either the @class or @id attribute required on these  
elements). With authoring communities (microformats may be one  
example of this), the class keywords can be used for robot analysis  
of text. Isn't this what the WhatWG class keyword registry is for?  
That's how I understood it.

>> Of course those class names
>> could accompany <small>, but why use them on an element that comes  
>> with
>> presentational baggage.
>
> I fear you're misreprepresenting reality; span and div tags are  
> actually
> just presentational hooks in the real world.  They are the ultimate in
> presentational baggage: everything about them screams "I am a styling
> hook".

You're hearing "I am a styling hook" But what they are screaming is  
"please add a meaningful @class keyword to me." Only to the a UA  
that's only concerned with visually presenting the HTML elements  are  
all of the elements presentational hooks (leaving aside the few  
elements that have some behavioral semantics like <title>, <a>,  
<link>, <style>, <script>, etc.).

> A screen reader encountering <small> could do something with it,
> but one encountering a generic <span> or <div> tag could not.  (I'm
> ignoring Aural CSS here, granted, but I got the impression that
> screenreaders tend to ignore it too.)

No, screen readers and aural/speech CSS UAs ignore CSS (not the good  
ones anyway). However, what meaning does <small> convey that a screen  
reader can use draw on a common aural idiom (like enunciating for  
<em>)? Using a @class registry combined with aural/tactile/visual  
default idioms for presenting those meanings is a far better approach  
than registering presentational oriented class keywords (like small,  
italics, bold, red, loud, etc.).

Take care,
Rob

Received on Wednesday, 18 July 2007 09:33:29 UTC