Re: (code, sample output and keyboard/device input <code>, <samp>, <kybd>) part of my review of 3.12 Phrase elements

At 06:56 -0500 UTC, on 2007-07-20, Robert Burns wrote:

> On Jul 20, 2007, at 5:48 AM, Anne van Kesteren wrote:

[...]

>> The latter doesn't give you any semantics unless you define some
>> microformat.
>
> How does:
>
> <pre><code> some c++ code here.</code></pre>
>
> provide more semantics than
>
> <pre class='c-plusplus-code' >some c++ code here</pre>

By the mere fact that <code> has a defined meaning  and class names do not. A
user might have their user CSS say code {display: none}, but isn't likely to
have rule for .c-plusplus-code.

> Are you really saying that if a microformat doesn't tell you what I
> mean, you cannot discern anything from that source code. Granted, a
> user would have to look at the HTML source

And would, in order to be able to extract meaning from a class name, [1] have
to be human and [2] have to have a good understanding of the language in
which the class name was written. A spec-defined <code> doesn't impose either
limitation.

Anyway, maybe I missed an essential bit, but I don't understand why one
should not write <pre><code class="c-plusplus"> some c++ code
here.</code></pre>. (I do understand the usefulness of having standardised
programming language indicators. Just not why they should be classnames, or
why <code> should not be used.)

> (unless UAs provide a
> mechanism to see class attribute values

FWIW, CSS 2 capable UAs already do to some extend, through user CSS:

*[class]:before {content: attr(class); color: #000; background: #ff9}

But it's not very practical for anything other than sytudying HTML in the
wild. Most class names are meaningless, so the odd meaningful class name gets
buried. (The user experience would probably be even worse than having to rely
on @alt.)


-- 
Sander Tekelenburg
The Web Repair Initiative: <http://webrepair.org/>

Received on Tuesday, 24 July 2007 02:26:50 UTC