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

Paul Prescod ([email protected])
Fri, 04 Aug 1995 20:10:43 -0400


At 12:49 PM 8/4/95 EDT, 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.

Which says to me that it exists to fill a much larger need than just that of
style sheets. I must admit the spec is very wishy washy on the issue:

"CLASS
This a space separated list of SGML NAME tokens and is used to subclass
tag names. By
convention, the class names are interpreted hierarchically, with the
most general class on
the left and the most specific on the right, where classes are
separated by a period. 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."

I would take the first sentence (which does not mention presentation) as the
actual definition of the attribute. The rest seems to be "usage tips." I
think that it is unfortunate tha the "usage tips" elevate a particular
application of the attribute (styles) and relegate others to side effects.
C'est la vie. As you say, it isn't a black and white issue:

>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:
..

>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.

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_. Whoever does this is
using a mechanism _intended_ for subclassing as a mechanism for changing
tags. So yes, the CLASS attribute is open to several different kinds of
abuse, but using it to indicate various subtypes of a master type is _not_
one of them.

This one-LIST proposal has flaws, but there is nothing inherently wrong with
expressing semantics (ordered, unordered etc.) in subCLASSes instead of
elements. The line where something becomes a subCLASS instead of its own
element is fuzzy, and will always be. For example, how do I express the
concept of an ordered, non-numerical list, like a chronological list? Is
there any particualr reason that a definition list should be a "first-order"
element and my chronological list must get relegated to a subclass of OL? I
don't think there is a hard and fast rule.

Paul Prescod

----------------------------------------------------------
Paul Prescod (mailto:[email protected])