Re: CLASS attribute (Was: No IMG in FIG)

Ka-Ping Yee (kryee@novice.uwaterloo.ca)
Sun, 6 Aug 1995 01:26:00 -0400


michaelj@relay.relay.com (Michael Johnson) wrote:

> Some have proposed using the CLASS attribute of EM to replace those tags. My
> opinion is that this is an abuse of the CLASS attribute. I infer from the
> IETF draft and comments in the DTD that CLASS exists purely to allow elements
> to be subclassed for the purposes of presentation. I do not think that Dave
> intended CLASS to be used to dynamically define new semantic markup, nor do I
> think it would be a good idea to use it for this.

I have to disagree strongly here. Semantics are inherently unbounded, and
require an unbounded mechanism for their communication.

Joe English wrote:
> Actually, that's precisely what CLASS was designed for.

Michael Johnson:
> There is of course a gray area in here, since the most meaningful use of
> the CLASS attribute is going to use some semantically-derived class name:
>
> <author class="principle">Joe Author</author> and
> <author class="collaborator">Fred Kibbitz</author> wrote in
>
> Rather than:
>
> <author class="red">Joe Author</author> and
> <author class="yellow">Fred Kibbitz</author> wrote in

And why should not CLASS be meaningful? The latter example looks much
more like an abuse of CLASS to me. I thought we were trying to avoid
explicit styles in HTML; ...class="red" is not really that much better
than throwing in <RED> or <YELLOW>, which i think we agree is not good.

Michael Johnson wrote:
> In general however, those semantics are not going to change the actual
> meaning of the element. Joe Author and Fred Kibbitz are still both
> authors. In a case like this:
>
> <em class="author,principle">Joe Author</em> and
> <em class="author,collaborator">Fred Kibbitz</em> wrote in
>
> The actual meaning of the element EM has been changed. This is no longer
> a phrase that should be brought to the attention of the reader. It is
> now the name of an author, which might or might not need to be brought
> to the attention of the reader.
>
> In my opinion this is a bad way to use the CLASS attribute.

Paul Prescod wrote:
> I think we all agree on that. If an "author" is not an "emphasis" then the
> "author" pseudo-element should not be a subclass of the "em" element. But
> this is no longer _subclassing_ it is _changing_.

Agreement also. CLASS is for refining, not replacing.

Michael Johnson wrote:
> Can you provide references that show that this was the designer's intent?

Joe English wrote:
> No. I've looked. Every mention of the "CLASS" attribute I've been able
> to find in any archive only mentions its use as a stylesheet hook.
[...]
> I was mistaken: user-defined semantic extensions appear not to have
> been the motivation behind CLASS and it is intended only for
> stylesheet processing.

Really? I think the following is reasonably clear (from [1]):
> The CLASS attribute is most commonly used to attach a different style to
> some element, but it is recommended that where practical class names
> should be picked on the basis of the element's semantics, as this will
> permit other uses, such as restricting search through documents by
> matching on element class names.

If stylesheets *only* were truly the motivation -- and i *hope* this is not
so -- then i ask that we aim at a broader interpretation!

CLASS is capable of giving *so much more* information than what might
simply be used for text styles. As i've mentioned before, text styles
are not the only way to convey information! (In fact, they are a
remarkably inadequate way of doing so when strictly-assigned meanings
are not understood by all parties.)

Paul Prescod (referring to the excerpt from the specification):
> I think that it is unfortunate tha the "usage tips" elevate a particular
> application of the attribute (styles) and relegate others to side effects.

I agree on this. CLASS has many uses, of which styles are only one,
and this should be made clear.

Michael Johnson wrote:
> I can recall some threads about RENDER but the CLASS attribute was not
> added until long after RENDER went away and was in fact added in place
> of the STYLE attribute which was there to hook in style sheets.

Paul Prescod wrote:
> Which says to me that it exists to fill a much larger need than just
> that of style sheets.

Mike Batchelor wrote:
> That may have been the germ for the idea way back when... (it was
> originally called the RENDER attribute, I believe). But it has since
> evolved into a much more general and useful attribute.

Perhaps the popularity of discussion about stylesheets (no doubt prompted
in response to users clamouring for presentation control) has led too
quickly to the thinking that "CLASS = stylesheets". Maybe it would be
a good idea for the W3 documents about HTML to point out more often that
CLASS can be used in more ways?

Ping (Ka-Ping Yee): 2B Computer Engineering, University of Waterloo, Canada
kryee@csclub.uwaterloo.ca | 62A Churchill St, Waterloo N2L 2X2, 519 886-3947
CWSF 89, 90, 92; LIYSF 90, 91; Shad Valley 92; DOE 93; IMO 91, 93; ACMIPC 94
** Belldandy * Hayakawa Moemi * Ayukawa Madoka * Hiyama Hikaru * Amano Ai **
draft Video Girl Ai manga full-translations posted - vgaiml-l@ualtavm.bitnet